Formula reference changes depending on filename written on a cell

MiKos23

New Member
Joined
Apr 25, 2017
Messages
3
Good day,

I created a timekeeping and payroll in excel for our company (company cannot afford to purchase a PR software). So there are 2 files, 1 pure timekeeping (biometric records converted to number of hours) and payroll computation. The payroll computation will get the data from the timekeeping file. The problem arises when I copy and paste it for a new record (ie copy the PR file for Jan 15 and make it a PR file for Jan 30 pay period). Most of the cells i have to manually edit the formula to point in the correct timekeeping file..

Here is the formula i stated:

=IF(AN8=0,0,INDEX('D:\Payroll\2017 PAYROLL\Payroll 12.30.17\[TIMEKEEPING FOR 12.30.17.xlsx]TKS'!$E$5:$AJ$650,MATCH($B8,'D:\Payroll\2017 PAYROLL\Payroll 12.30.17\[TIMEKEEPING FOR 12.30.17.xlsx]TKS'!$C$5:$C$650,0),MATCH(AT$6,'D:\Payroll\2017 PAYROLL\Payroll 12.30.17\[TIMEKEEPING FOR 12.30.17.xlsx]TKS'!$E$3:$AJ$3,0)))

Let us say that the last pay period was 12/30/17 and that is also the file name. for the new pay period 1/15/18, the formula would be change to.

=IF(AN8=0,0,INDEX('D:\Payroll\2018 PAYROLL\Payroll 1.15.18\[TIMEKEEPING FOR 1.15.18.xlsx]TKS'!$E$5:$AJ$650,MATCH($B8,'D:\Payroll\2018 PAYROLL\Payroll 1.15.18\[TIMEKEEPING FOR 1.15.18.xlsx]TKS'!$C$5:$C$650,0),MATCH(AT$6,'D:\Payroll\2018 PAYROLL\Payroll 1.15.18\[TIMEKEEPING FOR 1.15.18.xlsx]TKS'!$E$3:$AJ$3,0)))

is there a way to just type it the file in a cell (i.e. a3 = 1.30.18) so that excel will automatically look in that file like:

=IF(AN8=0,0,INDEX('D:\Payroll\2018 PAYROLL\Payroll 1.30.18\[TIMEKEEPING FOR 1.30.18.xlsx]TKS'!$E$5:$AJ$650,MATCH($B8,'D:\Payroll\2018 PAYROLL\Payroll 1.30.18\[TIMEKEEPING FOR 1.30.18.xlsx]TKS'!$C$5:$C$650,0),MATCH(AT$6,'D:\Payroll\2018 PAYROLL\Payroll 1.30.18\[TIMEKEEPING FOR 1.30.18.xlsx]TKS'!$E$3:$AJ$3,0)))

Hope someone can help
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try

=IF(AN8=0,0,INDEX('D:\Payroll\2018 PAYROLL\Payroll 1.15.18\[TIMEKEEPING FOR "&TEXT(A3,"mm.dd.yy")&".xlsx]TKS'!$E$5:$AJ$650,MATCH($B8,'D:\Payroll\2018 PAYROLL\Payroll "&TEXT(A3,"mm.dd.yy")&"\[TIMEKEEPING FOR "&TEXT(A3,"mm.dd.yy")&".xlsx]TKS'!$C$5:$C$650,0),MATCH(AT$6,'D:\Payroll\2018 PAYROLL\Payroll "&TEXT(A3,"mm.dd.yy")&"\[TIMEKEEPING FOR "&TEXT(A3,"mm.dd.yy")&".xlsx]TKS'!$E$3:$AJ$3,0)))

with a date value in A3

You may need to use INDIRECT() in the above for each TEXT() in there, I'm not sure.
e.g.

...INDIRECT('D:\Payroll\2018 PAYROLL\Payroll 1.15.18\[TIMEKEEPING FOR "&TEXT(A3,"mm.dd.yy")&".xlsx]TKS'!$E$5:$AJ$650)...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,910
Messages
6,181,675
Members
453,061
Latest member
schiefA

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