Formula to reference a different sheet based on date in field

NWPhotoExplorer

New Member
Joined
Jan 19, 2021
Messages
34
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello all,

I have built a time entry sheet that keeps track of the time worked each day for the year. The sheets are called 2019, 2020, 2021. In cell B1, I have the year that the sheet is for. I'm am looking for a way I can pull the data for the final week of the previous year on a different sheet without having to hardcode in the sheet name.

I have tried google and a combination of SUBSTITUTE, CONCATENATE, etc, and cannot seem to come up with anything. I am hoping someone might know how to do this.

Work Hours.xlsx
ABCDEFGHIJKLMNOPQ
12022WEEKLY HOURSBEGINNING PTO BALANCEPTO ACCRUED Total
2YEAR STAR DATE
31/3/2022
4
5WeekStart DateEnd DateHoliday HoursPTO HoursRegular HoursOvertime HoursTotal HoursPTO TotalPTO Accrural
65212/27/20211/2/2022
7DayDateStart Time (hh:mm)Lunch Start (hh:mm)Lunch End (hh:mm)Break Start (hh:mm)Break End (hh:mm)End Time (hh:mm)Hours (decimal)Hour TypePTO Accrual
8Monday12/27/20210:000:000:000:000:000:00
9Tuesday12/28/20210:000:000:000:000:000:00
10Wednesday12/29/20210:000:000:000:000:000:00
11Thursday12/30/20210:000:000:000:000:000:00
12Friday12/31/20210:000:000:000:000:000:00
13Saturday1/1/20220:000:000:000:000:000:00
14Sunday1/2/20220:000:000:000:000:000:00
15WeekStart DateEnd DateHoliday HoursPTO HoursRegular HoursOvertime HoursTotal HoursPTO TotalPTO Accrural
1611/3/20221/9/2022
17DayDateStart Time (hh:mm)Lunch Start (hh:mm)Lunch End (hh:mm)Break Start (hh:mm)Break End (hh:mm)End Time (hh:mm)Hours (decimal)Hour TypePTO Accrual
18Monday1/3/20227:0012:3013:0015:30
19Tuesday1/4/2022
20Wednesday1/5/2022
21Thursday1/6/2022
22Friday1/7/2022
23Saturday1/8/2022
24Sunday1/9/2022
Sheet1
Cell Formulas
RangeFormula
B6:D6,M8:M14,J8:K14,G8:H14,E8:E14B6='2021'!B526
D8D8=B3-7
D9:D14,D19:D24D9=D8+1
C16C16=D18
D16D16=D24
D18D18=B3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E16Expression=E16=0textNO
E6Expression=E6=0textNO
O16Expression=$O16>$AM16textNO
G16Expression=G16=0textNO
G6Expression=G6=0textNO
O6Expression=$O6>$AM6textNO


Thanks!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi NWPhotoExplorer,

You'll need to use INDIRECT.

Here I have "This is xxxx" in cell E3 of the shets 2020, 2021 and 2022 where xxxx is that year.
In my Sheet1 I have B1 with the year you want.
The INDIRECT in B6 builds the reference to retrieve the data:

1611867628685.png
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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