VLOOKUP or INDEX/MATCH utilizing day of the week

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
146
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet, on which there are 5 columns. Row 1 has the day of the week and the remaining rows have start times for my team. I would like to reference these in another workbook so I can determine the time difference between when they punched in versus when their shift starts. (I don't have access to the payroll software due to HR restrictions).

Based on the actual day of the week I run this, I'd like to have a formula that locates the respective column and then generates the corresponding start time within that column. I anticipate it would require an Index/Match formula but can that be done in combination with a weekday lookup? Below is the formula I used that would pull Thursday's data but I was hoping to setup something within a macro that could automatically pull without me needing to update the column index number each day of the week. TYIA

Excel Formula:
=VLOOKUP(A2,'[Start Times.xlsx]Sheet1'!$B:$F,4,FALSE)

MondayTuesdayWednesdayThursdayFriday
9:309:3010:0010:309:30
9:309:3012:309:3010:00
9:309:309:309:309:30
11:009:008:008:008:00
8:008:008:009:008:00
8:309:308:308:3011:30
10:309:309:309:308:30
9:309:309:309:309:30
9:009:009:009:009:00
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I am contemplating and wouldn't be against using =TODAY() and =WEEKDAY() to reference the TODAY cell and generate the numerical day of the week. Can that be used with an INDIRECT for the column index number in the above referenced VLOOKUP to remove the need for an INDEX/MATCH formula? Would that be easier and less bulky?
 
Upvote 0
Try
Excel Formula:
=VLOOKUP(A2,'[Start Times.xlsx]Sheet1'!$B:$F,WEEKDAY(TODAY(),2),FALSE)
 
Upvote 0
Solution
I'm not sure it's working. How should it reference the first row with the weekdays?
You'll just have to wait until tomorrow to find out if your result differs from today. 😉... Jk.

Compare the result of the formula with the one in the OP. The result should reflect Friday (today) vs. Thursday (yesterday).
It's not necessary to reference the first row. WEEKDAY returns the corresponding column index for the VLOOKUP.
 
Upvote 0
You'll just have to wait until tomorrow to find out if your result differs from today. 😉... Jk.

Compare the result of the formula with the one in the OP. The result should reflect Friday (today) vs. Thursday (yesterday).
It's not necessary to reference the first row. WEEKDAY returns the corresponding column index for the VLOOKUP.
ok it wasn't working for me yesterday but after an adjustment on my part, today's data appears to be generating. That's neat! I'll double check next Monday and confirm but thank you for your help on this one @Cubist
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

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