Home > Enterprise >  Count how many values in Column D are bigger than in Column C based on criteria in Column B
Count how many values in Column D are bigger than in Column C based on criteria in Column B

Time:12-09

A B C D E
1 Product Brand sales_volume purchase_volume
2 Product_A Brand_A 500 400
3 Product_B Brand_A 600 700
4 Product_C Brand_B 300 250
5 Product_D Brand_B 800 620
6 Product_E Brand_A 100 100
7 Product_F Brand_C 300 400

With reference to the answer in this question in Cell E2 I want to:

Count how many values in Column D are bigger than in Column C only for Brand_A

How do I need to adjust this formula =SUM(IF(D2:D7>C2:C7;1;0)) to add Brand_A as a criteria?

CodePudding user response:

Use SUMPRODUCT:

=SUMPRODUCT((D2:D7>C2:C7)*(B2:B7="Brand_A"))
  • Related