Formula to reference a cell between two spreadsheets

Trying2learnVBA

Board Regular
Joined
Aug 21, 2019
Messages
67
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
S1 is my macro template.
S2 is the actual report which gets a new tab each month. Ex. T1-Jan T2-Feb- etc- to current month.

Sometimes there are changes to S2. So, I want a system to cross check if anything has changed.

Exaple.

S1 n S2 look identical unless a new loan type was added.

So - I want to do this simple formula but for S2 active tab-sheet.

Say I do this on S1 any cell of my choice "=A8=S2 active sheet A8"
S1 =A8="S2 A8" works but once I make a new tab - The formula references the old tab.

Thanks for the help in advance.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Re: Help finding a formula to reference a cell between two spreadsheets

=A9='P:\MONTHEND\2019\[LNST2019.xls.xlsx]Aug 19'!A9

That's the simple formula. Is there a command/way to change "Aug 19" to be something like "Active Sheet"?
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

Is there a command/way to change "Aug 19" to be something like "Active Sheet"?
You would have to use the INDIRECT function, and build the entire reference.
You can use the method here to get the active sheet name: https://exceljet.net/formula/get-sheet-name-only
(Note that your workbook must be saved in order for this to work!)

So your final formula would look something like this:
Code:
=INDIRECT("'P:\MONTHEND\2019\[LNST2019.xls.xlsx]" [COLOR=#0000ff]& MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255) &[/COLOR] "'!A9")
 
Last edited:
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

I am sorry guys but I can't get it to work.

Do I need to make any changes to the Code given to me by Joe4?
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

What happens when you put that formula in the cell?
What does it return?
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

it says "#REF!"
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

Sounds like it cannot find a file/sheet with that name.
Try the formula without the INDIRECT function wrapped around it, so you can see what the inner part returns, and confirm that it is correct, i.e.
Code:
="'P:\MONTHEND\2019\[LNST2019.xls.xlsx]" [COLOR=#0000ff]& MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255) &[/COLOR] "'!A9"
Does it look exactly like?
='P:\MONTHEND\2019\[LNST2019.xls.xlsx]Aug 19'!A9

If you enter the formula above in a cell, do you get a result back or the #REF error?
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

Ok, I tried the formula on the other sheet. It returned the number on that cell.
So, I guess I want the formula to work from the other wb.

Also - I wanted a simple true or false. True if = false if not equal. But returning the actual cell value can help me to verify the info. It would be easier n faster if it said true or false instead
 
Upvote 0
Re: Help finding a formula to reference a cell between two spreadsheets

Once you verify and get it working on the sheet you wanted using the methods I decribed in the previous thread, you can easily make it True/False by adding the first part you had originally, i.e.
Code:
[COLOR=#ff0000]=A9[/COLOR]=INDIRECT("'P:\MONTHEND\2019\[LNST2019.xls.xlsx]" [COLOR=#0000ff]& MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255) &[/COLOR] "'!A9")
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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