CountIF When Looking at Other Data

Amosbroker

New Member
Joined
Mar 26, 2018
Messages
32
I am looking to count values if there is data present in other columns. I am creating a cohort trend and only want to count records for which both years have a value. See below, I do not want to count previous or current year category due to current value being unknown for red record. How do incorporate a CountIf that only counts records that have either good, borderline, or too high in each category in each year?


[TABLE="width: 601"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Member ID[/TD]
[TD]Previous Value[/TD]
[TD]Category [/TD]
[TD]Current Value[/TD]
[TD]Category [/TD]
[TD]Risk Movement [/TD]
[/TR]
[TR]
[TD]IDXX[/TD]
[TD]115[/TD]
[TD]Good[/TD]
[TD]115[/TD]
[TD]Good[/TD]
[TD]No Movement[/TD]
[/TR]
[TR]
[TD]IDxx[/TD]
[TD]178[/TD]
[TD]Too High[/TD]
[TD]178[/TD]
[TD]Too High[/TD]
[TD]No Movement[/TD]
[/TR]
[TR]
[TD]ID123[/TD]
[TD]143[/TD]
[TD]Borderline[/TD]
[TD]143[/TD]
[TD]Borderline[/TD]
[TD]No Movement[/TD]
[/TR]
[TR]
[TD]ID1234[/TD]
[TD]108[/TD]
[TD]Good[/TD]
[TD]101[/TD]
[TD]Good[/TD]
[TD]No Movement[/TD]
[/TR]
[TR]
[TD]ID12345[/TD]
[TD]100[/TD]
[TD]Good[/TD]
[TD][/TD]
[TD]Unknown[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thanks a ton!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi,

Not exactly clear on what you want.

If you want a Separate count for each Year/Column, then use H1 formula (change range for the other column).
If you want a Combined count for both Year/Columns, then use I1 formula.


Book1
ABCDEFGHI
1Member IDPrevious ValueCategoryCurrent ValueCategoryRisk Movement54
2IDXX115Good115GoodNo Movement
3IDxx178Too High178Too HighNo Movement
4ID123143Borderline143BorderlineNo Movement
5ID1234108Good101GoodNo Movement
6ID12345100GoodUnknown
Sheet54
Cell Formulas
RangeFormula
H1=SUM(COUNTIFS(C2:C6,{"Good","Borderline","Too High"}))
I1=SUM(COUNTIFS(C2:C6,{"Good","Borderline","Too High"},E2:E6,{"Good","Borderline","Too High"}))
 
Upvote 0
I need the Good, Borderline and Too High Count for each year but only the years that have values for each year. So for example, on line 6 - I would not count the Good for column C because Year 2 Column F is unknown. Does that make sense?
 
Last edited:
Upvote 0
Basically I need to count each Good, Borderline, and Too High - but ONLY if there is data for each year. If there is an unknown for either of the years, then I do not want to count the data in either year. I am only assessing values that have available data in both years.
 
Upvote 0
If the I1 formula in my post #2 is not doing what you're describing, please show sample results, then I can adjust the formula.
 
Upvote 0
Thanks for the reply jtakw - I ended up using a few array formulas to do the the job:

SUM(COUNTIFS($L$2:$L$1000,{"Good"},$N$2:$N$1000,{"Good";"Too High";"Borderline"}))

I swapped out Good, Too High and Borderline for the formulas that followed.
 
Upvote 0
Still not sure what you want, but Glad you've got it working.

The formula you posted seems like a Regular formula rather than an array formula...
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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