Change of Excel Formula Dynamic Variable

bmpreston

Board Regular
Joined
Jun 18, 2016
Messages
120
Office Version
  1. 365
Platform
  1. MacOS
Hello

I'm looking to make this:

='C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report 9-4-17.xlsx]Burris, Michael'!$E1

Use a variable cell reference for the DATE.

='C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report B2.xlsx]Burris, Michael'!$E1

B2 is a date.

I've tried this:

=INDIRECT("C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report " & B2 &".xlsx]Burris, Michael'!$E1")

No dice

Thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
=INDIRECT("'C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report "&TEXT(B2,"d-m-yy")&".xlsx]Burris, Michael'!$E1")
 
Upvote 0
excel store the dates as numbers, e.g. 9-4-17 stored as 42982.

try replace B2 in your formula to TEXT(B2,"d-m-yy"), swap the d & m around if you're using the m-d-yyyy format in B2
 
Last edited:
Upvote 0
Seems that none of this works. Everything gives a #REF .

I tried just to remove the variable and see if that works with the INDIRECT function, and same thing, just a #REF .

Both =INDIRECT("'C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report "&TEXT(B2,"m-d-yyyy")&".xlsx]Burris, Michael'!$E1")

(B2 is "9-4-17, and 9-4-2017 respectively)

and

=INDIRECT("'C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report 9-4-17.xlsx]Burris, Michael'!$E1")

Interestingly, removing the INDIRECT, the parenthesis, the outer quotes, and the value does populate, meaning the file is valid and structure is accurate. I've read that file names with spaces are an issue with INDIRECT, is this true?

Thanks
 
Upvote 0
I was not aware of the open workbook requirement at first, but I can say its open now while testing, and I repaste the formula into a new clean cell and same thing.

If I paste in the un'formulized' cell equals it asks for the file location. Just pasting the =INDIRECT cell call, it will ask for the location. I think that's telling.

Any help is appreciated.
 
Upvote 0
With the file opened see if this works
EDIT
=INDIRECT("'[Master Region Stale Report "&TEXT(B2,"d-m-yy")&".xlsx]Burris, Michael'!$E1")



M.
 
Last edited:
Upvote 0
So after a delay I'm back working on this. It's really aggravating I can't get it. If I call the sheet, workbook, cell accordingly, it works without a hitch. When I ask it to concatenate the formula by using the date in a cell, as part of the sheet name to reference I get #REF . Workbook open or not.

Interestingly a few points. If I run just a TEXT(CELL WITH DATE "D2","m-d-yy") I get a #Name

This formula without the Text call in it, works great:

=SUM('C:\Users\bprest1\Backup\Documents\Inventory\Master Region Stale\2017\[Master Region Stale Report 10-2-17.xlsx]Burris, Michael'!$E$1)

This does not, because the TEXT function seems to fail

=INDIRECT("'[Master Region Stale Report "&TEXT(B2,"m-d-yy")&".xlsx]Burris, Michael'!$E1")

Doesn't matter if the sheet is open or not....

Thanks in advance
 
Upvote 0
Just for clarity...
=TEXT(B2,"m-d-yy")
this returns an error?
what is in B2? Are you sure its a real date?
test with =isnumber(B2)
 
Upvote 0
Just for clarity...
=TEXT(B2,"m-d-yy")
this returns an error?
what is in B2? Are you sure its a real date?
test with =isnumber(B2)


Correct. =Text does give a #NAME error, since I'm trying to evaluate why the bigger formula doesn't work.

I have just confirmed. (I'm actually using D2) =ISNUMBER(D2) Provide TRUE

D2 is DATE, formatted at M-D-YYYY

Thanks for responding.
 
Upvote 0

Forum statistics

Threads
1,214,999
Messages
6,122,645
Members
449,093
Latest member
Ahmad123098

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