How To Use VLOOKUP Using Date, To Find Corresponding Holiday With Additional Criteria

ColtonYYZ

New Member
Joined
Oct 29, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello!

I am looking for a way to do the following:

1. Use a given date in Sheet1
2. Go to Sheet2 and lookup the exact date from Sheet1 in table1, column1
3. If the date isn't listed in the table, end. (aka "")
4. Using date from Column 2, go back to Sheet1
5. If there is data present for the day before and the day after, display a checkmark box (I've already created cell reference for this which is located on Sheet2)
6. If there is data missing on either side of date, end. (aka no checkmark box will be displayed)

Here's what I am thinking so far: =IF(VLOOKUP(U6,Sheet2!$AQ$4:$AS$53,1,FALSE)="XXXX",Sheet2!$AO$3,Sheet2!$AO$4)

**The cell references are my actual references. In order to help me, feel free to change them if it makes it easier for you. The XXXX part is where I am stumped. Essentially the returned value (date if there is one), is then needed to look up back on Sheet1 as a point of reference to see if both adjacent cells have data (time) in them, in order to display the checkmark box in Cell Q15.

I've attached an illustration with a red arrow to show what I would like to appear if the conditions are met; as described above.

Any better way of doing this? This sounds pretty logical to me but if someone has a better, easier, foolproof way to do this, I'm all ears!

Sheet1
Week Ending:​
25-Feb-2023
DateStartBreakLunchBreakEndHoliday Pay
Sun17-Feb9:0010:0011:0012:0013:00
Mon18-Feb10:0011:0012:0013:0014:00Checkmark Box
Tue19-Feb11:0012:0013:0014:0015:00
Wed20-Feb12:0013:0014:0015:0016:00
Thu21-Feb13:0014:0015:0016:0017:00
Fri22-Feb14:0015:0016:0017:0018:00
Sat23-Feb15:0016:0017:0018:0019:00

Sheet2
Week EndingHolidayCheckmark Box Checked
31-Dec-202225-DecChristmas DayCheckmark Box Unchecked
7-Jan-20231-JanNew Year’s Day
25-Feb-202320-FebFamily Day
8-Apr-20237-AprGood Friday
15-Apr-202310-AprEaster Monday
27-May-202322-MayVictoria Day
1-Jul-20231-JulCanada Day
12-Aug-20237-AugCivic Holiday
9-Sep-20234-SepLabour Day
14-Oct-20239-OctThanksgiving
11-Nov-202311-NovRemembrance Day
30-Dec-202325-DecChristmas Day
 

Attachments

  • excel.jpg
    excel.jpg
    161.6 KB · Views: 15

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
according to your explanation you need a match on the date and a value for time to be present to show as a holiday. with that the below should work for you.
i did change the cell references and for simplicity i used "holiday" instead of the boxes you are using.
--------------------
Book1
ABCDEFGHIJKL
1Week Ending:25-Feb-23Week EndingHoliday
212/31/202212/25/2022Christmas Day
3DayDateStartBreakLunchBreakEndHoliday Pay1/7/20231/1/2022New Year’s Day
4Friday11/11/20229:0010:0011:0012:0013:00Holiday2/25/20232/20/2022Family Day
5Friday11/18/202210:0011:0012:0013:0014:00 4/8/20234/7/2022Good Friday
6Friday11/25/202211:0012:0013:0014:0015:00 4/15/20234/10/2022Easter Monday
7Friday12/2/202212:0013:0014:0015:0016:00 5/27/20235/22/2022Victoria Day
8Friday12/9/202213:0014:0015:0016:0017:00 7/1/20237/1/2022Canada Day
9Friday12/16/202214:0015:0016:0017:0018:00 8/12/20238/7/2022Civic Holiday
10Sunday12/25/202215:0016:0017:0018:0019:00Holiday9/9/20239/4/2022Labour Day
1110/14/202310/9/2022Thanksgiving
1211/11/202311/11/2022Remembrance Day
1312/30/202312/25/2022Christmas Day
Sheet1
Cell Formulas
RangeFormula
H4:H10H4=IFNA(IF(AND(IF(MATCH(B4,$K$2:$K$13,0)>0,TRUE,FALSE),IF(ISBLANK(G4),FALSE,TRUE)),"Holiday",""),"")
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

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