Lookup/Vlookup to find exact date

UndwaterExcelWeaver

New Member
Joined
Mar 2, 2019
Messages
38
Office Version
  1. 365
Platform
  1. Windows
I am using the formula below to try and extract data from another workbook. It works fine until there is a date with no associated values. In the formula, "D1" is the destination sheet's date, and column B is the date column in the source sheet. Column J is the data I want to extract. For example, when I am looking for February 14th, it correctly finds and inserts the data associated with the 14th. There is no data associated with the 15th. However, when I run the formula in the destination sheet with the 15th as the date, it continues to pull in the data from 14th because it can't find anything for the 15th. I need the destination sheet to return no value if there is no value for that date in the source sheet.

I believe I need to use Vlookup instead of lookup so it only looks for the exact date, but I cannot figure this out so it works. I am always getting errors when trying this setup. Please help.

=LOOKUP(D1,'[Source.xlsx]sheet'!$B:$B,'[Destination.xlsx]sheet'!$J:$J)
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I am using the formula below to try and extract data from another workbook. It works fine until there is a date with no associated values. In the formula, "D1" is the destination sheet's date, and column B is the date column in the source sheet. Column J is the data I want to extract. For example, when I am looking for February 14th, it correctly finds and inserts the data associated with the 14th. There is no data associated with the 15th. However, when I run the formula in the destination sheet with the 15th as the date, it continues to pull in the data from 14th because it can't find anything for the 15th. I need the destination sheet to return no value if there is no value for that date in the source sheet.

I believe I need to use Vlookup instead of lookup so it only looks for the exact date, but I cannot figure this out so it works. I am always getting errors when trying this setup. Please help.

=LOOKUP(D1,'[Source.xlsx]sheet'!$B:$B,'[Destination.xlsx]sheet'!$J:$J)
Just to be clear, the two sheets are in different workbooks
 
Upvote 0
LOOKUP doesnt only look for exact matches.
Unsure of your version, but one of the three suggestions below should provide your answer:
VLOOKUP is susceptible to corruption by moving columns and data around.
XMATCH is in 365 and possibly later versions of Excel.
INDEX(MATCH()) and VLOOKUP are in nearly all the versions.

(Change "Not Found" in the formula to what ever suits you.)

Book1
ABCDEFGH
1
2LOOKUPINDEX(MATCH())VLOOKUPXLOOKUP
32024-02-1288882024-02-128
42024-02-13101010102024-02-1310
52024-02-14151515152024-02-1415
62024-02-1515Not FoundNot FoundNot Found2024-02-1617
72024-02-16171717172024-02-178
82024-02-1788882024-02-187
92024-02-1877772024-02-216
102024-02-197Not FoundNot FoundNot Found
112024-02-207Not FoundNot FoundNot Found
122024-02-216666
13
Sheet2
Cell Formulas
RangeFormula
B3:B12B3=LOOKUP(A3,$G$3:$G$9,$H$3:$H$9)
C3:C12C3=IFERROR(INDEX($H$3:$H$9,MATCH($A3,$G$3:$G$9,0)),"Not Found")
D3:D12D3=IFERROR(VLOOKUP(A3,$G$3:$H$9,2,0),"Not Found")
E3E3=XLOOKUP($A3,$G$3:$G$9,$H$3:$H$9,"Not Found",0,1)
E4:E12E4=XLOOKUP(A4,$G$3:$G$9,$H$3:$H$9,"Not Found",0,1)
 
Last edited:
Upvote 0
LOOKUP doesnt only look for exact matches.
Unsure of your version, but one of the three suggestions below should provide your answer:
VLOOKUP is susceptible to corruption by moving columns and data around.
XMATCH is in 365 and possibly later versions of Excel.
INDEX(MATCH()) and VLOOKUP are in nearly all the versions.

(Change "Not Found" in the formula to what ever suits you.)

Book1
ABCDEFGH
1
2LOOKUPINDEX(MATCH())VLOOKUPXLOOKUP
32024-02-1288882024-02-128
42024-02-13101010102024-02-1310
52024-02-14151515152024-02-1415
62024-02-1515Not FoundNot FoundNot Found2024-02-1617
72024-02-16171717172024-02-178
82024-02-1788882024-02-187
92024-02-1877772024-02-216
102024-02-197Not FoundNot FoundNot Found
112024-02-207Not FoundNot FoundNot Found
122024-02-216666
13
Sheet2
Cell Formulas
RangeFormula
B3:B12B3=LOOKUP(A3,$G$3:$G$9,$H$3:$H$9)
C3:C12C3=IFERROR(INDEX($H$3:$H$9,MATCH($A3,$G$3:$G$9,0)),"Not Found")
D3:D12D3=IFERROR(VLOOKUP(A3,$G$3:$H$9,2,0),"Not Found")
E3E3=XLOOKUP($A3,$G$3:$G$9,$H$3:$H$9,"Not Found",0,1)
E4:E12E4=XLOOKUP(A4,$G$3:$G$9,$H$3:$H$9,"Not Found",0,1)
Thank you very much. XLookup achieved what I needed.
 
Upvote 0
You probably should put that in a fresh post since this is about LOOKUP, and not FILTER/SUMIF/SUMIFS/SUMPRODUCT/SUM and array functions/formulas.
I'd be happy to answer it there.

But, you do need to update your profile with your Excel version. And using the xl2bb add in (link below) to share mini worksheets is very helpful and you should use it if you can. If you cannot, then post your sample data in TABLES.
 
Upvote 0
You probably should put that in a fresh post since this is about LOOKUP, and not FILTER/SUMIF/SUMIFS/SUMPRODUCT/SUM and array functions/formulas.
I'd be happy to answer it there.

But, you do need to update your profile with your Excel version. And using the xl2bb add in (link below) to share mini worksheets is very helpful and you should use it if you can. If you cannot, then post your sample data in TABLES.
I have updated my profile and posted a new thread.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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