ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   I need a formula to sum column b if column a is between two dates (https://www.excelbanter.com/excel-discussion-misc-queries/22459-i-need-formula-sum-column-b-if-column-between-two-dates.html)

Pam

I need a formula to sum column b if column a is between two dates
 
I have an excel spreadsheet with employees time off. I need a formula that
will add column b if column a is betwee two dates. For example: if column a
is between 9/22/04 and 9/21/05 then add column b. I have tried all different
formluas but can't get this to work.

JulieD

=SUMPRODUCT(--(A2:A100DATEVALUE("9/22/04")),--(A2:A100<DATEVALUE("9/21/05")),B2:B100)

check out
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
for details on the sumproduct function

"Pam" wrote:

I have an excel spreadsheet with employees time off. I need a formula that
will add column b if column a is betwee two dates. For example: if column a
is between 9/22/04 and 9/21/05 then add column b. I have tried all different
formluas but can't get this to work.


Ron Rosenfeld

On Mon, 18 Apr 2005 09:34:03 -0700, Pam wrote:

I have an excel spreadsheet with employees time off. I need a formula that
will add column b if column a is betwee two dates. For example: if column a
is between 9/22/04 and 9/21/05 then add column b. I have tried all different
formluas but can't get this to work.


=SUMIF(A:A,"="&DATE(2004,9,22),B:B) - SUMIF(A:A,""&DATE(2004,9,21),B:B)

You may find it more convenient to but the Dates into cells, in which case
merely substitute the cell reference for the DATE function in the above.


--ron


All times are GMT +1. The time now is 08:02 AM.

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