ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sum if column is equal to 2 options (https://www.excelbanter.com/excel-discussion-misc-queries/195647-sum-if-column-equal-2-options.html)

jimar

sum if column is equal to 2 options
 
Column A contains 3 types of data ie apples, oranges or lemons. Column B
contains the number of each item purchased and col C contains the date of
purchase. I need a formula which will count the total number of apples and
oranges purchased in May. (Answer should be 20) Grateful for any help.

Col A Col B Col C
apples 5 4/5/08
apples 6 6/5/08
lemons 4 7/5/08
apples 1 1/6/08
oranges 9 3/5/08

Max

sum if column is equal to 2 options
 
One way
Assuming data in A1:C5, with real dates in col C
In say, E1:
=SUMPRODUCT((TEXT(C1:C5,"mmmyy")="May08")*((A1:A5= "apples")+(A1:A5="oranges")),B1:B5)
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,000 Files:354 Subscribers:53
xdemechanik
---
"jimar" wrote:
Column A contains 3 types of data ie apples, oranges or lemons. Column B
contains the number of each item purchased and col C contains the date of
purchase. I need a formula which will count the total number of apples and
oranges purchased in May. (Answer should be 20) Grateful for any help.

Col A Col B Col C
apples 5 4/5/08
apples 6 6/5/08
lemons 4 7/5/08
apples 1 1/6/08
oranges 9 3/5/08


jimar

sum if column is equal to 2 options
 
Thanks Max. This done the trick.

"Max" wrote:

One way
Assuming data in A1:C5, with real dates in col C
In say, E1:
=SUMPRODUCT((TEXT(C1:C5,"mmmyy")="May08")*((A1:A5= "apples")+(A1:A5="oranges")),B1:B5)
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,000 Files:354 Subscribers:53
xdemechanik
---
"jimar" wrote:
Column A contains 3 types of data ie apples, oranges or lemons. Column B
contains the number of each item purchased and col C contains the date of
purchase. I need a formula which will count the total number of apples and
oranges purchased in May. (Answer should be 20) Grateful for any help.

Col A Col B Col C
apples 5 4/5/08
apples 6 6/5/08
lemons 4 7/5/08
apples 1 1/6/08
oranges 9 3/5/08


Max

sum if column is equal to 2 options
 
Welcome. Take a moment to press the "Yes" button below.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,200 Files:354 Subscribers:53
xdemechanik
---
"jimar" wrote:
Thanks Max. This done the trick.




All times are GMT +1. The time now is 07:48 PM.

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