Index match a time to +/- 3 seconds (If it's possible that is)

BigErn

New Member
Joined
Jun 25, 2018
Messages
2
Hi All,
Hi time poster (because I'm stuck!!). I've two tables both have a number reference and a start time. I'm trying to index a text column in one table, match the number and start time and show the text in the other table. Not a problem I've used to following formula.

{=INDEX($F$18:$F$32,MATCH(1,($C2=$A$18:$A$32)*($I2=$I$18:$I$32),0))}

ABCDEFGHI
1StationFacilityWord3Word22Word5FaultDescRsnCodeRsnDescStartTime
29131MS01911701=Aboveformula101Step 1 interlock25/06/2018 11:46:36
3
4
etc

<tbody>
</tbody>




17
ABCDEFGH
18StationFacilityWord3Word22Word5FaultDescRsnCodeRsnDescStartTime
199117OP3009307610:._025S521 UN104 Part Present101Step 1 interlock25/06/2018 11:46:36
20
21
etc

<tbody>
</tbody>


My problem is that the Start time doesn't always exact match, it can be +/-3 seconds out which is a real pain!! Can anybody advise me how to do this?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I BELIEVE this should work. You just need to be a little less specific in your match and allow for a +/i by looking >= t-3 and <= t+3 like so

{=INDEX($F$18:$F$32,MATCH(1,($C2=$A$18:$A$32)*($I2-TIMEVALUE("0:00:03")<=$I$18:$I$32)*($I2+TIMEVALUE("0:00:03")>=$I$18:$I$32),0))}

edit: same functionality, but using TIME is perhaps a little shorter (if slightly more obsure as to what it is doing)

{=INDEX($F$18:$F$32,MATCH(1,($C2=$A$18:$A$32)*($I2-TIME(0,0,3)<=$I$18:$I$32)*($I2+TIME(0,0,3)>=$I$18:$I$32),0))}
 
Last edited:
Upvote 0
Internally, Excel is representing dates as floating point numbers. The integer part is the date and the fractional part is the time. With this in mind you can compare the time as floating point numbers which might be easier.
 
Upvote 0
I BELIEVE this should work. You just need to be a little less specific in your match and allow for a +/i by looking >= t-3 and <= t+3 like so

{=INDEX($F$18:$F$32,MATCH(1,($C2=$A$18:$A$32)*($I2-TIMEVALUE("0:00:03")<=$I$18:$I$32)*($I2+TIMEVALUE("0:00:03")>=$I$18:$I$32),0))}

edit: same functionality, but using TIME is perhaps a little shorter (if slightly more obsure as to what it is doing)

{=INDEX($F$18:$F$32,MATCH(1,($C2=$A$18:$A$32)*($I2-TIME(0,0,3)<=$I$18:$I$32)*($I2+TIME(0,0,3)>=$I$18:$I$32),0))}

Sir,
You are a gentleman and a scholar! Works brilliantly many thanks.
 
Upvote 0

Forum statistics

Threads
1,215,700
Messages
6,126,281
Members
449,308
Latest member
VerifiedBleachersAttendee

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