Vlookup a specific time and return name only if specific time is between a range of Current Time

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
163
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

Here is the challenge, have this table:


09:00 Jen
10:00 Frank
11:00 Tom
12:00 Hannah


The goal is to Vlookup time in column A and return name in column B only if the time in column A is between range of +20 minutes of current time and -20 minutes of current time.


Can you help me?


Thanks to all.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try this,

Code:
=INDEX(B2:B5,SUMPRODUCT(((A2:A5>=NOW()-(20/24/60))*(A2:A5<=NOW()+(20/24/60)))*ROW(INDIRECT("1:" & COUNTA(A2:A5)))))
 
Upvote 0
If you have schedules spaced by one hour, then in a certain period you will not find a name, for example, if the current time is between 8:21 and 8:39, +/- 20 minutes, you will not find any time, since the results would be from 8:01 to 8:41 and 8:29 to 8:59, then you do not find any time.
But if you have schedules every 20 minutes, then the following formula is enough:

Excel Workbook
ABC
1TimeNAMEName Current Time
216:00Name1Name7
316:20Name2
416:40Name3
517:00Name4
617:20Name5
717:40Name6
818:00Name7
918:20Name8
1018:40Name9
1119:00Name10
1219:20Name11
1319:40Name12
1420:00Name13
1520:20Name14
1620:40Name15
Sheet
 
Last edited:
Upvote 0
Try this,

Code:
=INDEX(B2:B5,SUMPRODUCT(((A2:A5>=NOW()-(20/24/60))*(A2:A5<=NOW()+(20/24/60)))*ROW(INDIRECT("1:" & COUNTA(A2:A5)))))

First, thanks for your support.

Tried the formula however only returns the first name even though the hour still changes.

Can you please check?

Thanks again.
 
Upvote 0
If you have schedules spaced by one hour, then in a certain period you will not find a name, for example, if the current time is between 8:21 and 8:39, +/- 20 minutes, you will not find any time, since the results would be from 8:01 to 8:41 and 8:29 to 8:59, then you do not find any time.
But if you have schedules every 20 minutes, then the following formula is enough:

Sheet

ABC
1TimeNAMEName Current Time
216:00Name1Name7
316:20Name2
416:40Name3
517:00Name4
617:20Name5
717:40Name6
818:00Name7
918:20Name8
1018:40Name9
1119:00Name10
1219:20Name11
1319:40Name12
1420:00Name13
1520:20Name14
1620:40Name15

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 80px;"><col style="width: 80px;"><col style="width: 129px;"></colgroup><tbody>
</tbody>

Formulas
CellFormula
C2=VLOOKUP(TIMEVALUE(TEXT(NOW(),"HH:MM")),A2:B16,2,1)

<tbody>
</tbody>

<tbody>
</tbody>


Excel Tabellen im Web darstellen >> Excel Jeanie HTML 4.8

First, thanks for your support.

The Formula works great however I would like to mantain the initial hour structure (like 09:00; 10:00; 11:00...).

Just ask with that do you have any ideas?

Thanks a lot.
 
Upvote 0
First, thanks for your support.
The Formula works great however I would like to mantain the initial hour structure (like 09:00; 10:00; 11:00...).
Just ask with that do you have any ideas?
Thanks a lot.

Try this:

Excel Workbook
ABCD
1TimeNAMEName Current TimeCurrent Time
209:00Name1Name310:43
310:00Name2
411:00Name3
512:00Name4
613:00Name5
714:00Name6
815:00Name7
916:00Name8
1017:00Name9
1118:00Name10
1219:00Name11
1320:00Name12
1421:00Name13
1522:00Name14
1623:00Name15
Sheet
 
Upvote 0
Works Great!!!!!
Excellent!!!
Thank you very much!!!!!
 
Upvote 0
I'm glad to help you. I appreciate your kind comments.
 
Upvote 0
Try this:

Excel Workbook
ABCD
1TimeNAMEName Current TimeCurrent Time
209:00Name1Name310:43
310:00Name2
411:00Name3
512:00Name4
613:00Name5
714:00Name6
815:00Name7
916:00Name8
1017:00Name9
1118:00Name10
1219:00Name11
1320:00Name12
1421:00Name13
1522:00Name14
1623:00Name15
Sheet
@DanteAmor

Dear DanteAmor,

Hope you are fine.
As you were the mentor of this wonderful solution just reach you because would like the same result however has to change the format hour to 09H, 10H, 11H... instead of 09:00, 10:00, 11:00... as you can check in table below.
Can you please help?
Thanks again my friend.💪👍🍻

TimeNAMEName Current TimeCurrent Time
09HName1=IFERROR(OFFSET(B1,SUMPRODUCT((A2:A5>=TIMEVALUE(TEXT(NOW()-"00:20","hh:mm")))*(A2:A5<=TIMEVALUE(TEXT(NOW()+"00:20","hh:mm")))*ROW(A2:A5))-1,0),"without coincidences")10:43
10HName2
11HName3
12HName4
13HName5
14HName6
15HName7
16HName8
17HName9
18HName10
19HName11
20HName12
21HName13
22HName14
23HName15
 
Upvote 0
If your data is like this:
Libro1
ABCD
1TimeNAMEName Current TimeCurrent Time
209HName111H11:35:50 a. m.
310HName2
411HName3
512HName4
613HName5
714HName6
815HName7
916HName8
1017HName9
1118HName10
1219HName11
1320HName12
1421HName13
1522HName14
1623HName15
Hoja1


Try this:

Excel Formula:
=LET(A2:A16,a,IFERROR(INDEX(a,SUMPRODUCT((SUBSTITUTE(a,"H","")+0>=TEXT(NOW()-"00:20","hh")+0)*(SUBSTITUTE(a,"H","")+0<=TEXT(NOW()+"00:20","hh")+0)*ROW(a))-ROW($A$2)+1),"without coincidences"))

😇
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,180
Members
448,871
Latest member
hengshankouniuniu

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