Counting multiple columns

datadummy

Active Member
Joined
Mar 16, 2017
Messages
313
Office Version
  1. 365
Platform
  1. Windows
I need assistance writing multiple countif statements. Example countif 'Sheet1'!C1:C100,"Y" or if 'Sheet1'!D1:D100,"Y". I currently have it written as follows, =COUNTIFS('Post-Visit-Call-Raw-Data'!AE:AE,"Y",OR(IF('Post-Visit-Call-Raw-Data'!AL:AL,"Y"))) and am getting an error. Thanks in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Here is one way:
Code:
[COLOR=#333333]=COUNTIF('Post-Visit-Call-Raw-Data'!AE:AE,"Y") + COUNTIF('Post-Visit-Call-Raw-Data'!AL:AL,"Y") - COUNTIFS([/COLOR][COLOR=#333333]'Post-Visit-Call-Raw-Data'!AE:AE,"Y",[/COLOR][COLOR=#333333]'Post-Visit-Call-Raw-Data'!AL:AL,"Y")[/COLOR]
 
Upvote 0
Easier way is to sum your answers

=SUM(COUNTIF('Post-Visit-Call-Raw-Data'!AE:AE,"Y"),COUNTIF('Post-Visit-Call-Raw-Data'!AL:AL,"Y"))
 
Upvote 0
I didn't do a very good job explain my ask, what I am trying to do is look at the columns above (AE & AN) but rather than adding them together I'm looking for a statement that will essentially say if either one has "Y" in it then count it as Y in a composite field. Hope this helps, sorry for any confusion.
 
Upvote 0
I didn't do a very good job explain my ask, what I am trying to do is look at the columns above (AE & AN) but rather than adding them together I'm looking for a statement that will essentially say if either one has "Y" in it then count it as Y in a composite field. Hope this helps, sorry for any confusion.
That is what my solution does. It counts the number of rows where a Y occurs in either column.

The logic is this:
- Add the total number of rows where "Y" occurs in column AE to the total number of rows where "Y" occurs in column AN.
- However, that could lead to "double-counting", if "Y" occurs in BOTH columns AE and AN for some rows.
- How do we account for that? Simply, subtract the number of rows where both columns "AE" and "AN" contain a "Y".

That is how my solution works.
Have you tried both of the solutions presented to see if they work?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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