Assign a value based on a date within date ranges

SeleneExcel

New Member
Joined
Jun 12, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need to assign a label to data based on the date, which falls within a date range. I organized my dates as follows:

StartEndRange Label
01/01/2103/28/21Aqueduct Winter
04/01/2104/18/21Aqueduct Spring
04/22/2107/11/21Belmont Spring/Summer
07/15/2109/06/21Saratoga
09/16/2110/31/21Belmont Fall
11/05/2112/05/21Aqueduct Fall
12/09/2112/31/21Aqueduct Winter
01/01/2203/27/22Aqueduct Winter
03/31/2204/24/22Aqueduct Spring
04/28/2207/10/22Belmont Spring/Summer
07/14/2209/05/22Saratoga
09/15/2210/30/22Belmont Fall
11/04/2212/04/22Aqueduct Fall
12/08/2212/31/22Aqueduct Winter


For example, if I have a pay date ending 3/28/2021, I want it to return to "Aqueduct Winter."
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Something like this maybe?
Book1
ABC
1StartEndRange Label
201/01/202103/28/2021Aqueduct Winter
304/01/202104/18/2021Aqueduct Spring
404/22/202107/11/2021Belmont Spring/Summer
507/15/202109/06/2021Saratoga
609/16/202110/31/2021Belmont Fall
711/05/202112/05/2021Aqueduct Fall
809/12/202112/31/2021Aqueduct Winter
901/01/202203/27/2022Aqueduct Winter
1003/31/202204/24/2022Aqueduct Spring
1104/28/202207/10/2022Belmont Spring/Summer
1207/14/202209/05/2022Saratoga
1309/15/202210/30/2022Belmont Fall
1411/04/202212/04/2022Aqueduct Fall
1512/08/202212/31/2022Aqueduct Winter
16
17Examples
18Date 103/28/2021Aqueduct Winter
19Date 210/30/2021Belmont Fall
20Date 307/12/2022Date outside all date ranges!
Sheet1
Cell Formulas
RangeFormula
C18:C20C18=IFERROR(INDEX($C$2:$C$15,MATCH(1,(B18>=$A$2:$A$15)*(B18<=$B$2:$B$15),0)),"Date outside all date ranges!")
 
Upvote 0
Solution
Thank you! It worked great!
I tried transposing to my worksheet but it didn't work becasue the data is on one tab, and the Pay Code table, is on a different tab. How can we make it work?

This is the sheet where I have the data (tab name, "Pay Type Hours Earnings"):
1686768865431.png


And this is the sheet where I have the categories (tab name, "Racing Days"):
1686768988463.png
 
Upvote 0
You just need to 'point' the formulas to the tab where the lookup range is, something like this:
Racing Days tab
Book1
ABC
1StartEndRange Label
201/01/202103/28/2021Aqueduct Winter
304/01/202104/18/2021Aqueduct Spring
404/22/202107/11/2021Belmont Spring/Summer
507/15/202109/06/2021Saratoga
609/16/202110/31/2021Belmont Fall
711/05/202112/05/2021Aqueduct Fall
809/12/202112/31/2021Aqueduct Winter
901/01/202203/27/2022Aqueduct Winter
1003/31/202204/24/2022Aqueduct Spring
1104/28/202207/10/2022Belmont Spring/Summer
1207/14/202209/05/2022Saratoga
1309/15/202210/30/2022Belmont Fall
1411/04/202212/04/2022Aqueduct Fall
1512/08/202212/31/2022Aqueduct Winter
Racing Days


Pay Type Hours Earnings tab (partial)
Book1
NOPQRST
1Pay Ending DateMeet
201/03/2021Aqueduct Winter
307/10/2021Belmont Spring/Summer
408/08/2022Saratoga
507/12/2022Date outside all date ranges!
Pay Type Hours Earnings
Cell Formulas
RangeFormula
T2:T5T2=IFERROR(INDEX('Racing Days'!$C$2:$C$15,MATCH(1,(N2>='Racing Days'!$A$2:$A$15)*(N2<='Racing Days'!$B$2:$B$15),0)),"Date outside all date ranges!")
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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