excelexcel-formula

Lookup from Excel database of specific dates to consecutive time series of dates


I have a list of specific dates with data, as shown in the below table.

Specific Dates Label
01-Jan-20 A
10-Jan-20 B
16-Jan-20 C
25-Jan-20 D

How do I perform an Excel lookup into the Label column for a full month time series?

Dates Label
01-Jan-20
02-Jan-20
03-Jan-20
04-Jan-20
05-Jan-20
06-Jan-20
07-Jan-20
08-Jan-20
09-Jan-20
10-Jan-20
11-Jan-20
12-Jan-20
13-Jan-20
14-Jan-20
15-Jan-20
16-Jan-20
17-Jan-20
18-Jan-20
19-Jan-20
20-Jan-20
21-Jan-20
22-Jan-20
23-Jan-20
24-Jan-20
25-Jan-20
26-Jan-20
27-Jan-20
28-Jan-20
29-Jan-20
30-Jan-20

The desired output is as follows:

Dates Label
01-Jan-20 A
02-Jan-20 A
03-Jan-20 A
04-Jan-20 A
05-Jan-20 A
06-Jan-20 A
07-Jan-20 A
08-Jan-20 A
09-Jan-20 A
10-Jan-20 B
11-Jan-20 B
12-Jan-20 B
13-Jan-20 B
14-Jan-20 B
15-Jan-20 B
16-Jan-20 C
17-Jan-20 C
18-Jan-20 C
19-Jan-20 C
20-Jan-20 C
21-Jan-20 C
22-Jan-20 C
23-Jan-20 C
24-Jan-20 C
25-Jan-20 D
26-Jan-20 D
27-Jan-20 D
28-Jan-20 D
29-Jan-20 D
30-Jan-20 D

Solution

  • You can use this formula:

    
    =INDEX(tblLabels[Label],MATCH([@Dates],tblLabels[Specific Dates],1))
    

    Important is 1 at the end of the MATCH-part - the date that is searched for has to be lower than the date in column A

    https://i.imgur.com/k7alu6w.png