Sum if, I think

Sammi8796

Board Regular
Joined
Dec 12, 2007
Messages
100
Office Version
  1. 2016
Platform
  1. Windows
I have a column (B) that lists material numbers. In column B it may or may not repeat the material number. I have the following formula set up so it will count how many different material numbers are listed and so it won't count the same number twice.

=SUMPRODUCT((B2:B103<>"")/COUNTIF(B2:B103,B2:B103&""))

I need a variation of this formula for another cell. I still want to sum up the material numbers in column B but I need it to depend on whats in column C. In column C it will either say "A" or "B" next to each material number. I want it to look at column C and count the material numbers only once in column B. So I want to sum up the "B" material numbers and the "A" material numbers. Remember that the material numbers may appear more than once. Hope that makes sense. Any help would be appreciated. Thanks.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Excel Workbook
CellFormula
=SUM(IF(FREQUENCY(IF(((LEN(B2:B103)>0)*(C2:C103="A")),MATCH(B2:B103,B2:B103,0),""), IF(LEN(B2:B103)>0,MATCH(B2:B103,B2:B103,0),""))>0,1))
Array Formula
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Upvote 0
I have a column (B) that lists material numbers. In column B it may or may not repeat the material number. I have the following formula set up so it will count how many different material numbers are listed and so it won't count the same number twice.

=SUMPRODUCT((B2:B103<>"")/COUNTIF(B2:B103,B2:B103&""))

I need a variation of this formula for another cell. I still want to sum up the material numbers in column B but I need it to depend on whats in column C. In column C it will either say "A" or "B" next to each material number. I want it to look at column C and count the material numbers only once in column B. So I want to sum up the "B" material numbers and the "A" material numbers. Remember that the material numbers may appear more than once. Hope that makes sense. Any help would be appreciated. Thanks.

Less expensive...

Control+shift+enter, not just enter...
Code:
=SUM(IF(FREQUENCY(IF(B2:B103<>"",IF(C2:C103="A",
   MATCH("~"&B2:B103,B2:B103&"",0))),ROW(B2:B103)-ROW(B2)+1),1))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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