If a date is between 2 different Dates then Return Week Number

SiuGuy007

New Member
Joined
Jun 19, 2015
Messages
40
I am not 100% sure how to write the formula for this? On Sheet 1, I have various dates for new hired EE's. On Sheet 2, I have a list of "From Date" and "To Date", with the corresponding Week number.

If the New Hired EE date falls between the From and To Dates, I need to have the result return the week number.

From DateTo DateWeek numberNew Hire EE
January 1, 2018January 7, 2018Week 011/4/2018
January 8, 2018January 14, 2018Week 021/5/2018
January 15, 2018January 21, 2018Week 031/6/2018
January 22, 2018January 28, 2018Week 041/7/2018
January 29, 2018February 4, 2018Week 051/8/2018

<colgroup><col span="2"><col><col><col></colgroup><tbody>
</tbody>

Any assistance is greatly appreciated.

SIUGuy007
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi,

You can use LOOKUP or INDEX/MATCH:


Book1
ABCDEFG
1From DateTo DateWeek numberNew Hire EELOOKUPINDEX/MATCH
21-Jan-187-Jan-18Week 011/4/2018Week 01Week 01
38-Jan-1814-Jan-18Week 021/5/2018Week 01Week 01
415-Jan-1821-Jan-18Week 031/6/2018Week 01Week 01
522-Jan-1828-Jan-18Week 041/7/2018Week 01Week 01
629-Jan-184-Feb-18Week 051/8/2018Week 02Week 02
Sheet44
Cell Formulas
RangeFormula
F2=LOOKUP(E2,A$2:A$6,C$2:C$6)
G2=INDEX(C$2:C$6,MATCH(E2,A$2:A$6,1))


Either way, formula copied down.
 
Upvote 0
My apologies for the delay in acknowledging your prompt reply and answer to my question. Very much appreciated. The Lookup formula did not work, however, the Match formula did.

Thanks again,

SIUGuy
 
Upvote 0
One other quick question. Instead of returning the week number (E2), I would like to count the total number of dates between the from and to periods.
 
Upvote 0
I'm not sure I understanding your new question.

Are you saying the number of days FROM and TO columns A & B, each line separately, or Total (A2 to B6)?
Or are you saying the number of days within FROM and TO COLUMNS A & B, Starting with Hire date (column E), each line separately?

Please give sample and desired results.
 
Upvote 0
Thank you for your reply. I guess I should say it this way. If an EE Hire date is between 2 different Dates (From and To Date) then Return the count. Example below.

EE Hire DateFrom DateTo Date Week #Results
4/6/20184/2/20184/8/2018 Week 141
4/14/20184/9/20184/15/2018 Week 151
4/25/20184/16/20184/22/2018 Week 160
4/25/20184/23/20184/29/2018 Week 173
4/25/20184/30/20185/6/2018 Week 181

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
I'm not following the logic/math in your sample results above, please explain How you got 1, 1, 0, 3, 1?
 
Upvote 0
Under EE Hire date, there is 1 new hire on 4/6/18. This is the only new hire date that fell between 4/2/18 to 4/8/18. 4/6/18 equals 1.
Under EE Hire date, there 3 new hires on 4/25/18. These 3 new hire dates fell between 4/23/18 to 4/29/18. Those 3 dates equal 3.
And so on!
 
Upvote 0
Thank you for your reply. I guess I should say it this way. If an EE Hire date is between 2 different Dates (From and To Date) then Return the count. Example below.

EE Hire Date
From Date
To Date
Week #
Results
4/6/2018
4/2/2018
4/8/2018
Week 14
1
4/14/2018
4/9/2018
4/15/2018
Week 15
1
4/25/2018
4/16/2018
4/22/2018
Week 16
4/25/2018
4/23/2018
4/29/2018
Week 17
3
4/25/2018
4/30/2018
5/6/2018
Week 18
1

<tbody>
</tbody>

But you're showing 1 hire in red above, that's what threw me off.
 
Upvote 0

Forum statistics

Threads
1,214,608
Messages
6,120,500
Members
448,968
Latest member
screechyboy79

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