SUMIF to calculate Number of Days between Dates in 2 Columns Meeting Criterial

eveready

New Member
Joined
May 7, 2013
Messages
3
Hi, Please help

I have 2 Columns of Holiday Dates (Column A is the "FROM" date; and Column B is the 'TO' date) and Column C is Peoples Names corresponding to the Holiday dates:

ie:

COLUMN 1 ; COLUMN 2 ; COLUMN 3
A1= 2 Jan 13 ; B1= 10 Jan 13 ; C1= Tom
A2= 4 May 13 ; B2= 10 Jun 13 ; C2= John
A3= 7 Jul 13 ; B3= 10 Jul 13 ; C3= Tom
A4= 3 Aug 13 ; B4= 25 Aug 13 ; C4= John
A5= 6 Dec 13 ; B5= 15 Dec 13 ; C5= John.

I am trying to figure out a formula (eg SUMIF) to calcluate and summarize the number of Days Holiday based on a person's name (eg Tom's total Number of days Holiday days) based on the above column configuration of Dates and Names.

Please help.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Always very helpful if the desired results, calculated manually, are also included. That said, guessing:

E1: Tom
E2: John

F1, control+shift+enter, not just enter, and copy down:

=SUM(IF($A$1:$A$5*$B$1:$B$5,IF($C$1:$C$5=E1,$B$1:$B$5-$A$1:$A$5)))

The following set up might be easier on you:

D1, just enter and copy down:

=IF(A1*B1,B1-A1,0)

Now you can invoke a SumIf formula in F1...

=SUMIF($C$1:$C$5,E1,$D$1:$D$5)
 
Upvote 0
Try something like this.

=SUMPRODUCT((B1:B5-A1:A5+1),--(C1:C5="Tom"))

You can replace "Tom" with a cell reference that contains the value "Tom"

The +1 means the dates are inclusive e.g. Jan 1 to Jan 2 is two days.
 
Upvote 0
MANY THANKS ALL RESPONDERS


I went for the simplest looking response and ALPHAFROG'S worked a treat.

Many thanks Alphafrog.

Regards


Try something like this.

=SUMPRODUCT((B1:B5-A1:A5+1),--(C1:C5="Tom"))

You can replace "Tom" with a cell reference that contains the value "Tom"

The +1 means the dates are inclusive e.g. Jan 1 to Jan 2 is two days.
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,710
Members
449,182
Latest member
mrlanc20

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