Count Criteria Based on Another Criteria

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
751
Office Version
  1. 365
Platform
  1. Windows
i have 2 columns. 1 with categories, another with values
Categories, Values
cat1, 10
cat1, 2
cat2, 3
cat2, 5
cat2,10
cat3, 6
etc

i would like to sum the value based on a specific category, so the formula would return 12 for cat1, 18 for cat2, 6 for cat3
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi,

I would use the formula SUMIFS. It allows you to sum values based on 1 and more conditions.

Lets say I have category in column A, and values in column B
=SUMIFS(B2:B7;A2:A7;"cat1") <--- instead of "cat1" you can use reference to a cell with the same name

'=SUMIFS(values;category;category you want to be summed up)
it sums up all values
that are in the category column and are defined as "cat1".

In case you would use older version 2003, then you should use SUMPRODUCT.
Pavla
 
Upvote 0
i made a mistake in the above, the sum of the values is easy because SUMIF allows SUMIF( range, criteria, [sum range]) i want to apply the same process to a Count if, so intinitial range, criteria of that initial range, then count values of another range

=countif(categories, "cat1", values)
 
Upvote 0

Forum statistics

Threads
1,203,352
Messages
6,054,910
Members
444,759
Latest member
TeckTeck

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