Extract vlook up dates

doriannjeshi

Board Regular
Joined
Apr 5, 2015
Messages
214
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I need to look up dates for a table in this format!

pyth new.xlsb
IJK
11940dateSign
2Jan 1 – Jan 31 Scorpio1/15/1941?
3Feb 1 – Mar 25 Sagittarius
4Mar 26 – Jun 5 Capricorn
5June 6 – Sep 28 Sagittarius
6Sep 29 – Nov 29 Capricorn
7Nov 30 – Dec 31 Aquarius
81941
9Jan 1 – Jan 20 Aquarius
10Jan 21 – Mar 7 Pisces
11Mar 8 – Apr 17 Aries
12Apr 18 – May 24 Taurus
13May 25 – Jun 28 Gemini
14Jun 29 – Jul 31 Cancer
15Aug 1 – Sep 1 Leo
16Sep 2 – Oct 5 Virgo
17Oct 6 – Nov 10 Libra
18Nov 11 Scorpio
19Dec 20 Sagittarius
201942
21Jan 1 – Feb 2 Sagittarius
22Feb 3 – Mar 26 Capricorn
23Mar 27 – Dec 10 Aquarius
24Dec 11 – Dec 31 Pisces
251943
26Jan 1 – Jan 27 Pisces
27Jan 28 – Mar 7 Aries
28Mar 8 – Apr 11 Taurus
29Apr 12 – May 14 Gemini
30May 15 – Jun 16Cancer
31Jun 17 – Jul 19 Leo
32Jul 20 – Aug 23Virgo
33Aug 24 – Sep 30 Libra
34Oct 1 – Nov 11Scorpio
35Nov 12 – Dec 27 Sagittarius
36Dec 28 – Dec 31 Capricorn
371944
38Jan 1 – Feb 15 Capricorn
39Feb 16 – Apr 8 Aquarius
40Apr 9 – Jun 4 Pisces
41Jun 5 – Aug 8 Aries
42Aug 9 – Nov 6 Taurus
43Nov 7 – Dec 31 Aries
441945
eros&psyche
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Here's a solution, but you need to arrange the data in column I into two different columns. The TRUE part of the formula is key, as it will make the VLOOKUP look for the next smallest value if it can't find the exact date you are looking for. This also means that "Date start" in the left table MUST be sorted ascendingly.

Book1
ABCDE
1Date startCategoryDateCategory
201/01/1940Scorpio15/01/1940Scorpio
301/02/1940Sagittarius15/02/1940Sagittarius
426/03/1940Capricorn30/10/1940Capricorn
506/06/1940Sagittarius
629/09/1940Capricorn
730/11/1940Aquarius
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=VLOOKUP(D2,$A$2:$B$7,2,TRUE)
 
Upvote 0
Is your data really that variable in format?
Examples
1. All leading month name are abbreviated to 3 letters - apart from row 5
2. Most of the Sign name are preceded by a space - but not rows 30, 32 7 34

Can you get the data in a uniform format?
 
Upvote 0
Here's a solution, but you need to arrange the data in column I into two different columns. The TRUE part of the formula is key, as it will make the VLOOKUP look for the next smallest value if it can't find the exact date you are looking for. This also means that "Date start" in the left table MUST be sorted ascendingly.

Book1
ABCDE
1Date startCategoryDateCategory
201/01/1940Scorpio15/01/1940Scorpio
301/02/1940Sagittarius15/02/1940Sagittarius
426/03/1940Capricorn30/10/1940Capricorn
506/06/1940Sagittarius
629/09/1940Capricorn
730/11/1940Aquarius
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=VLOOKUP(D2,$A$2:$B$7,2,TRUE)
Thank you Automatrix for the response and the solution!
 
Upvote 0
Is your data really that variable in format?
Examples
1. All leading month name are abbreviated to 3 letters - apart from row 5
2. Most of the Sign name are preceded by a space - but not rows 30, 32 7 34

Can you get the data in a uniform format?
1. I can fix all months having only 3 letters
2. I will fix this too

Yes I can uniform the format!
 
Upvote 0
Yes I can uniform the format!
In that case a somewhat similar solution would be to insert a new column immediately to the left of the date/sign column and enter the formula shown. That new column could then be hidden if you want.
Formula in col K to extract the result.

22 12 03.xlsm
HIJK
11940DateSign
21/01/1940Jan 1 – Jan 31 Scorpio15/01/1941Aquarius
31/02/1940Feb 1 – Mar 25 Sagittarius21/07/1943Virgo
426/03/1940Mar 26 – Jun 5 Capricorn21/07/1942Aquarius
56/06/1940Jun 6 – Sep 28 Sagittarius31/12/1944Aries
629/09/1940Sep 29 – Nov 29 Capricorn
730/11/1940Nov 30 – Dec 31 Aquarius
8#VALUE!1941
91/01/1941Jan 1 – Jan 20 Aquarius
1021/01/1941Jan 21 – Mar 7 Pisces
118/03/1941Mar 8 – Apr 17 Aries
1218/04/1941Apr 18 – May 24 Taurus
1325/05/1941May 25 – Jun 28 Gemini
1429/06/1941Jun 29 – Jul 31 Cancer
151/08/1941Aug 1 – Sep 1 Leo
162/09/1941Sep 2 – Oct 5 Virgo
176/10/1941Oct 6 – Nov 10 Libra
1811/11/1941Nov 11 Scorpio
1920/12/1941Dec 20 Sagittarius
20#VALUE!1942
211/01/1942Jan 1 – Feb 2 Sagittarius
223/02/1942Feb 3 – Mar 26 Capricorn
2327/03/1942Mar 27 – Dec 10 Aquarius
2411/12/1942Dec 11 – Dec 31 Pisces
25#VALUE!1943
261/01/1943Jan 1 – Jan 27 Pisces
2728/01/1943Jan 28 – Mar 7 Aries
288/03/1943Mar 8 – Apr 11 Taurus
2912/04/1943Apr 12 – May 14 Gemini
3015/05/1943May 15 – Jun 16 Cancer
3117/06/1943Jun 17 – Jul 19 Leo
3220/07/1943Jul 20 – Aug 23 Virgo
3324/08/1943Aug 24 – Sep 30 Libra
341/10/1943Oct 1 – Nov 11 Scorpio
3512/11/1943Nov 12 – Dec 27 Sagittarius
3628/12/1943Dec 28 – Dec 31 Capricorn
37#VALUE!1944
381/01/1944Jan 1 – Feb 15 Capricorn
3916/02/1944Feb 16 – Apr 8 Aquarius
409/04/1944Apr 9 – Jun 4 Pisces
415/06/1944Jun 5 – Aug 8 Aries
429/08/1944Aug 9 – Nov 6 Taurus
437/11/1944Nov 7 – Dec 31 Aries
44#VALUE!1945
Lookup
Cell Formulas
RangeFormula
K2:K5K2=TRIM(RIGHT(SUBSTITUTE(VLOOKUP(J2,H$2:I$1000,2)," ",REPT(" ",20)),20))
H2:H44H2=DATEVALUE(MID(I2,5,2)&LEFT(I2,3)&LOOKUP(9999,I$1:I1))
 
Upvote 0
Solution
1. I can fix all months having only 3 letters
2. I will fix this too

Yes I can uniform the format!
1940dateSign
Jan 1 – Jan 31 Scorpio1/15/1941?
Feb 1 – Mar 25 Sagittarius
Mar 26 – Jun 5 Capricorn
Jun 6 – Sep 28 Sagittarius
Sep 29 – Nov 29 Capricorn
Nov 30 – Dec 31 Aquarius
1941
Jan 1 – Jan 20 Aquarius
Jan 21 – Mar 7 Pisces
Mar 8 – Apr 17 Aries
Apr 18 – May 24 Taurus
May 25 – Jun 28 Gemini
Jun 29 – Jul 31 Cancer
Aug 1 – Sep 1 Leo
Sep 2 – Oct 5 Virgo
Oct 6 – Nov 10 Libra
Nov 11 Scorpio
Dec 20 Sagittarius
1942
Jan 1 – Feb 2 Sagittarius
Feb 3 – Mar 26 Capricorn
Mar 27 – Dec 10 Aquarius
Dec 11 – Dec 31 Pisces
1943
Jan 1 – Jan 27 Pisces
Jan 28 – Mar 7 Aries
Mar 8 – Apr 11 Taurus
Apr 12 – May 14 Gemini
May 15 – Jun 16 Cancer
Jun 17 – Jul 19 Leo
Jul 20 – Aug 23 Virgo
Aug 24 – Sep 30 Libra
Oct 1 – Nov 11 Scorpio
Nov 12 – Dec 27 Sagittarius
Dec 28 – Dec 31 Capricorn
1944
Jan 1 – Feb 15 Capricorn
Feb 16 – Apr 8 Aquarius
Apr 9 – Jun 4 Pisces
Jun 5 – Aug 8 Aries
Aug 9 – Nov 6 Taurus
Nov 7 – Dec 31 Aries
1945
 
Upvote 0
one small issue I am having with a couple of dates that I tested do not work. Even when I type the date the datevalue returns error unless I enter it as text '

1990
32874Jan 1 – Jan 13 Capricorn
32887Jan 14 Aquarius
#VALUE!March 6 Pisces
#VALUE!April 24 Aries


1976
#VALUE!Jan 1 Capricorn
27761Jan 2 – Feb 21 Aquarius
27812Feb 22 Pisces


1945
#VALUE!Jan 1 – Aries
16439Jan 2 – Feb 14 Taurus
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

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