HLOOKUP Formula not selecting correct date

Aaronb4

New Member
Joined
Jan 2, 2023
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
I am currently trying to set up a personnel resourcing spreadsheet with a "SUMMARY" page that will display a total number of persons in each position based on todays date.

the summary page has a cell with =TODAY() that works fine,
I also have the following formula running to pull the data off a seperate table on another sheet : =IF(HLOOKUP(TODAY(),Sheet!184:185,1,TRUE)=TODAY(),HLOOKUP(TODAY(),Sheet!185:200,16,TRUE),NA())

for some reason it is only selecting the first date in the date and not cross referencing the dates.

i have added some screenshots for reference,

spreadsheethelp.PNG
 

Attachments

  • spreadsheethelp2.PNG
    spreadsheethelp2.PNG
    111.5 KB · Views: 10

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
it is only selecting the first date in the date and not cross referencing the dates.
I do not understand this statement. "first date in the date" is not clear and I don't know what you mean by "cross referencing".

The formula is doing what it says it does. It finds an approximate match for TODAY in row 184 (it is approximate because you are using TRUE as the last argument to HLOOKUP). It finds that date in column H (assuming your screenshot is from the say day you posted this question). Then it pulls the result from the same row (argument 1), and it is TODAY. Then you proceed to get the corresponding data from row 200. With this data the result is correctly shown as 0.

What are you expecting instead, and why?

This is not a great way to do this, by the way. There is no need to first check to see if the date exists. Also I am not sure why you are looking for an approximate date. The simplified formula below should also do what you want, returning NA if an exact match is not found:

Excel Formula:
=IFERROR(HLOOKUP(TODAY(),Sheet!185:200,16,FALSE),NA())
 
Upvote 0
I do not understand this statement. "first date in the date" is not clear and I don't know what you mean by "cross referencing".

The formula is doing what it says it does. It finds an approximate match for TODAY in row 184 (it is approximate because you are using TRUE as the last argument to HLOOKUP). It finds that date in column H (assuming your screenshot is from the say day you posted this question). Then it pulls the result from the same row (argument 1), and it is TODAY. Then you proceed to get the corresponding data from row 200. With this data the result is correctly shown as 0.

What are you expecting instead, and why?

This is not a great way to do this, by the way. There is no need to first check to see if the date exists. Also I am not sure why you are looking for an approximate date. The simplified formula below should also do what you want, returning NA if an exact match is not found:

Excel Formula:
=IFERROR(HLOOKUP(TODAY(),Sheet!185:200,16,FALSE),NA())
Hi sorry i was not very clear in my explanation.

So on the summary page it has Todays Date (Tuesday 3 January 2023), this date changes as the date does with =TODAY(). as that date changes i would like the numbers in the below tables on that page to reflect the corresponding numbers of the same date in the second sheet.

i will attempt to do your formula, i apologise again i am extremely new to this. thanks for your assistance
 
Upvote 0
Did you try Jeff's formula ? I think he might be a row out and his range should start at 184 and not 185, you will need to check if that means your 16 should be 17.
Rich (BB code):
        =IFERROR(HLOOKUP(TODAY(),Sheet!184:200,16,FALSE),NA())

Assuming that formula goes in N19 down, you might want to throw in a Match for the row lookup eg.
Rich (BB code):
=HLOOKUP( TODAY(), Sheet1!$184:$200, MATCH(M19,Sheet1!$B$184:$B$200,0), FALSE)
(Put in N19 and copy down to N26)
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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