lookupValue Query - date/timestamp within a period

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
769
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

Apologies for this query if it has been covered, but I am having no look finding anything.

I have a formula that works for an exact time with other criteria, but I need to be able to check the date/time and pull the value from another column.
This sounds easy, but the source data is in 2 formats as follows, the issue seems to be milliseconds
Sheet 1 where I am pulling the value shows the date/time as "12/07/2021 09:01:43"
Sheet 2 where the data is aligning to shows the data/time as "12/07/2021 09:01:00"

I am used to writing a lookupvalue as below, but have no idea how to include a ">=" for just the time part as the date will always be the same. I am looking to include a 2 minute window due to connect between departments, but I am unsure how to dal with the milliseconds part

Code:
=LOOKUPVALUE(Sheet1[Description],Sheet1[matchCriteria],Sheet2[matchCriteria],Sheet1[date],sheet2[date],Sheet1[date],"<="time(sheet2[date]+(00,02,00)

All help appreciated.
thanks
Gavin
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
The formula works if I setup the date time in both sheets as "12/07/2021 09:01" and use the formula as is
Code:
=LOOKUPVALUE(Sheet1[Description],Sheet1[matchCriteria],Sheet2[matchCriteria],Sheet1[date],sheet2[date],Sheet1[date],sheet2[date]

Which will only match the exact matches, but when I try and add in the "<="sheet2[date]-time(00,02,00)
I get a format/value issue on the Sheet1[date]

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,961
Members
452,539
Latest member
delvey

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