Sumproduct based on text values

mountainman88

Board Regular
Joined
Jun 22, 2019
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
I have been able to SUMPRODUCT a total amount in cell E4 using text entered into cells F1 and F2 to create conditions. How do I modify the formula so that if F1 contains the text "Total", that the conditions for the SUMPRODUCT are "Yes" AND "No", and if cell F2 contains the text "Total" the conditions for the SUMPRODUCT are "COS" AND "SGA" AND "Revenue"?

Thank


ABCDEF
1
IT?
PLAMTIT?Yes/No/Total
2YesCOS50000PLCOS/SGA/Revenue/Total
3YesSGA10000
4NoSGA20000Result:=SUMPRODUCT((C2:C5),--(A2:A5=F1),--(B2:B5=F2))
5YesRevenue40000
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
What answer did you expect.
consider the following and possibly expand or use choose.
T202007c.xlsm
ABCDEFG
1IT?PLAMTTotalCOS
2YesCOS50,000.00TotalSGA
3YesSGA10,000.00REVENUE
4NoSGA20,000.00Result:120,000.00
5YesRevenue40,000.00120,000.00
3b
Cell Formulas
RangeFormula
E4E4=SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,G1:G3,0))),(C2:C5))
E5E5=(F1="Total")*SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,G1:G3,0))),(C2:C5))
 
Upvote 0
T202007c.xlsm
ABCDEFG
1IT?PLAMTTotalCOS
2YesCOS50,000.00TotalSGA
3YesSGA10,000.00REVENUE
4NoSGA20,000.00Result:120,000.00
5YesRevenue40,000.00120,000.00
3b
Cell Formulas
RangeFormula
E4E4=SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,G1:G3,0))),(C2:C5))
E5E5=(F1="Total")*SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,{"COS";"SGA";"REVENUE"},0))),(C2:C5))
 
Upvote 0
T202007c.xlsm
ABCDEFG
1IT?PLAMTTotalCOS
2YesCOS50,000.00TotalSGA
3YesSGA10,000.00REVENUE
4NoSGA20,000.00Result:120,000.00
5YesRevenue40,000.00120,000.00
3b
Cell Formulas
RangeFormula
E4E4=SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,G1:G3,0))),(C2:C5))
E5E5=(F1="Total")*SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,{"COS";"SGA";"REVENUE"},0))),(C2:C5))
Hey this works perfectly and doesnt even slow the sheet down too much. Thanks for teaching me.
 
Upvote 0
T202007c.xlsm
ABCDEFG
1IT?PLAMTTotalCOS
2YesCOS50,000.00TotalSGA
3YesSGA10,000.00REVENUE
4NoSGA20,000.00Result:120,000.00
5YesRevenue40,000.00120,000.00
3b
Cell Formulas
RangeFormula
E4E4=SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,G1:G3,0))),(C2:C5))
E5E5=(F1="Total")*SUMPRODUCT(--(ISNUMBER(MATCH(B2:B5,{"COS";"SGA";"REVENUE"},0))),(C2:C5))
I have a solution that works well, thanks for your help
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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