Question

When a cell in A2:A100 meets a certain condition, I want to multiply a corresponding value by a factor and, for a different condition, the corresponding value by a different factor, eg when A2=:

"Banana" then B2*C2 but when  
"Apple"  then B2*C3 but when  
"Pear"   then B2*C4

and sum these results, all in a single cell.

So when A2="Banana" and A3="Pear" I want to have this: =B2*C2+B3*C4.

The corresponding values for the criteria in ColumnA are in ColumnB (matching row) and C2, C3 and C4 contain the factors appropriate to the criteria.

I have tried a big formula, but that took me like forever, and when I enter more values in ColumnA I have to adjust that formula.

Was it helpful?

Solution

Please try:

=SUMIF(A:A,"Apple",B:B)*C3+SUMIF(A:A,"Banana",B:B)*C2+SUMIF(A:A,"Pear",B:B)*C4  

oops - but with semicolons instead of commas!

OTHER TIPS

=IF(A2="banana";B2*C2;IF(A2="apple";B2*C3;B2*C4))

or do you need something simular but for 100+ cases?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top