문제

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.

도움이 되었습니까?

해결책

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!

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top