Adding numbers between certain dates.

Paul75

New Member
Joined
Apr 27, 2011
Messages
6
Hi,
Column A contains dates and column B contains numbers, they are both an array named 'flight_date' and 'flight_hours' respectively. In cell C1 I would like to enter a start date, and cell C2 an end date, and have cell C3 sum the total flight hours in between and including the 2 dates.
I tried the below formula but it keeps returning 0.0. Am not really sure how to do this.
{=SUMIF(flight_date,"<="&$C$2,flight_hours)-SUMIF(flight_date,"<"&$C$1,flight_hours)}

Hopefully someone can help.
Thanks,
Paul.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi,
Column A contains dates and column B contains numbers, they are both an array named 'flight_date' and 'flight_hours' respectively. In cell C1 I would like to enter a start date, and cell C2 an end date, and have cell C3 sum the total flight hours in between and including the 2 dates.
I tried the below formula but it keeps returning 0.0. Am not really sure how to do this.
{=SUMIF(flight_date,"<="&$C$2,flight_hours)-SUMIF(flight_date,"<"&$C$1,flight_hours)}

Hopefully someone can help.
Thanks,
Paul.
Try one of these...

For any version of Excel:

=SUMIF(flight_date,">="&C1,flight_hours)-SUMIF(flight_date,">"&C2,flight_hours)

For Excel 2007 and later:

=SUMIFS(flight_hours,flight_date,">="&C1,flight_date,"<="&C2)

If flight_hours is a time value then you might need to format the result as [h]:mm.
 
Upvote 0
Just made my evening, thanks Biff. Worst just as I had desired.

One more question if I may.

if the end date is left blank I would like it to use the most recent date from the array flight_date. I assume I would use max(flight_date) somehow but I can't figure out how.

Cheers,
Paul.
 
Upvote 0
Just made my evening, thanks Biff. Worst just as I had desired.

One more question if I may.

if the end date is left blank I would like it to use the most recent date from the array flight_date. I assume I would use max(flight_date) somehow but I can't figure out how.

Cheers,
Paul.
Try one of these...

All versions of Excel:

=SUMIF(flight_date,">="&C1,flight_hours)-IF(C2="",0,SUMIF(flight_date,">"&C2,flight_hours))

Excel 2007 and later:

=SUMIFS(flight_hours,flight_date,">="&C1,flight_date,"<="&IF(C2="",MAX(flight_date),C2))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,282
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top