Countifs multiple criteria across a row

theonlyhamish

New Member
Joined
Aug 13, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hi all, Just a beginner and have tried various iterations of the countifs and sum functions to achieve this calculation.

I am trying to generate a count of 3 columns with mixed criteria so that i can feed the data simply into a fixed report page (i was using a pivot table but the boss doesnt like the way that 'looks')

Ive attached an image with made up data and what i thought was the right formula Columns A,C,D have different values and i need to count at the end of that row if the row meets all 3 of the variables. There is likely a more simplistic way of achieving this than i have found!
 

Attachments

  • Capture.PNG
    Capture.PNG
    160.8 KB · Views: 21
Here's my stab at it . . . I am sure there are more elegant ways though

=IF(OR(OR(A2="House"),(A2="Bungalow"),(A2="Boat")),IF(OR(OR(C2="A"),(C2="B"),(C2="C")),IF(D2<4,1,0),0))
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Apologies - I think that last 0 is in the wrong place . . . Here's the corrected formula

=IF(OR(OR(A6="House"),(A6="Bungalow"),(A6="Boat")),IF(OR(OR(C6="A"),(C6="B"),(C6="C")),IF(D6<4,1,0)),0)
 
Upvote 0
Judging by the image in the op & the formula being used, the values in col D are text & not numbers.
 
Upvote 0
=IF(OR(OR(A6="House"),(A6="Bungalow"),(A6="Boat")),IF(OR(OR(C6="A"),(C6="B"),(C6="C")),IF(D6<4,1,0)),0)
This has pretty much nailed it!! One tiny thing is that some negative results are displaying '0' and some are displaying 'FALSE'. Any ideas?
 
Upvote 0
Did you try the formula in post#5 or post#8?
 
Upvote 0
Did you try the formula in post#5 or post#8?
Yes but i was only getting zero results, i have only changed the text to numbers following your last post, would that be the cause.

I really need to spend more time on excel
 
Upvote 0
Yes, text & numbers are totally different, try
Excel Formula:
=--(SUM(OR(A2={"House","Bungalow","Boat"}),OR(C2={"A","B","C"}),OR(D2={1,2,3}))=3)
 
Upvote 1
Solution
If you add Trim to @Phuoc's code it will work either way:
Excel Formula:
=OR(A2={"House","Bungalow","Boat"})*OR(C2={"A","B","C"})*OR(TRIM(D2)={"1","2","3"})
 
Upvote 0
Yes, text & numbers are totally different, try
Excel Formula:
=--(SUM(OR(A2={"House","Bungalow","Boat"}),OR(C2={"A","B","C"}),OR(D2={1,2,3}))=3)
That is perfect and has fixed the small issue that JV0710's solution had.

Thank you all for your help!
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top