ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   sumif (https://www.excelbanter.com/excel-worksheet-functions/175446-sumif.html)

SUMIF

sumif
 
If I have two column as below:
(ColumnA) (Column B)
1. Apple 35
2. Orange 5
3. Banana 9
4. Pear 25
5. Banana 18
6. Apple 56
7. Orange 36
8. watermelon 66
9. Orange 14
10.Apple 5
If I use SumIf like this =SUMIF(A1:A5,"Banana",B1:B5), it only come up 18+9
= 27.
How can I sum up more than two items in the ColumA, like sum up "Pear" +
"Apple" +"Orange" together.

Dave Peterson

sumif
 
You could use multiple =sumif()'s:

=SUMIF(A1:A5,"apple",B1:B5)
+SUMIF(A1:A5,"pear",B1:B5)
+SUMIF(A1:A5,"orange",B1:B5)

Or you could use something like:
=sum(SUMIF(A1:A5,{"apple","pear","orange"},B1:B5))

Adjust your range...I bet it doesn't stop with row 5.



sumif wrote:

If I have two column as below:
(ColumnA) (Column B)
1. Apple 35
2. Orange 5
3. Banana 9
4. Pear 25
5. Banana 18
6. Apple 56
7. Orange 36
8. watermelon 66
9. Orange 14
10.Apple 5
If I use SumIf like this =SUMIF(A1:A5,"Banana",B1:B5), it only come up 18+9
= 27.
How can I sum up more than two items in the ColumA, like sum up "Pear" +
"Apple" +"Orange" together.


--

Dave Peterson


All times are GMT +1. The time now is 03:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com