Solved

Excel Variable in Formula

Posted on 2012-04-03
9
221 Views
Last Modified: 2012-05-17
What I'm trying to do is simply have a formula insert the contents of another cell into a formula to reference a cell in another spreadsheet.

E012345           ='S:\Topdrive\share\locate\[E012345.xls]E012345'!$J$4
E57843              ='S:\Topdrive\share\locate\[E57843.xls]E57843'!$J$4
E90786           ='S:\Topdrive\share\locate\[E90786.xls]E90786'!$J$4

Using the above example, the first column in the spreadsheet is a vehicle number. The second column is the formula which will reference another cell with a separate spreadsheet. What I'm trying to do is have the formula reference the 1st column and grab that vehicle number instead of me having to had type it into the formula every time as I've done here.

I hope my explanation is clear. Please let me know.

Thanks
0
Comment
Question by:Cole3388
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Accepted Solution

by:
stephen81 earned 500 total points
ID: 37801564
You can use INDIRECT.

i.e.

=INDIRECT("[" &E25 & "]Sheet1!$A$1")

where E25 contains the filename of your external workbook.
0
 
LVL 6

Expert Comment

by:wshark83
ID: 37801599
I think what you need is a vlookup function:

=vlookup(<cell/value to lookup>,<range in which to look up>,<column to return>,FALSE)

I assume the 2nd spreadsheet which has the vehicle number also has the reference of the 1st column?
0
 
LVL 1

Expert Comment

by:stephen81
ID: 37801995
Just to add to my previous comment, as your first column obviously doesn't have the full path or workbook name, so you'd need to add that to your indirect formula.

i.e.

E012345           =INDIRECT("S:\Topdrive\share\locate\[" & A2 & "]" & A2 & "!$J$4")

(where cell A2 on the current sheet contains your vehicle number "E012345")
0
 
LVL 14

Expert Comment

by:Zack Barresse
ID: 37802319
Hello,

If you're trying to get values from a closed workbook, welcome to a long line of people trying to accomplish the same thing.  This is not native functionality.  While some people may use the INDIRECT() function, it's problemmatic.  You can use the INDIRECT.EXT() function, or you could lookup help on the web regarding the PULL() function, which is a UDF designed by Harlan Grove (and some others I believe) which does a better job of this.  The problem is it can be resource intensive, as it would need to literally open a copy of the workbook every time a recalc is done.  Add this to a dozen or two functions and you start to get the idea of how resource intensive this process actually is.  These are about your best options.

Regards,
Zack Barresse
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Expert Comment

by:stephen81
ID: 37802331
Yes, apologies, I was assuming your other workbooks were open already.
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37804073
INDIRECT.EXT() works a charm for me.  Much, much faster than PULL.  How is it that it does a better job for you, Zack?

Dave
0
 
LVL 14

Expert Comment

by:Zack Barresse
ID: 37804131
It has a tendency to fail on multiple iterations.  It's a very well known issue, and one which hasn't really ever been addressed (very well).  Yes, it will work though, as I said.  PULL() however is more robust.

Zack
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37804155
I just tested PULL with a simple vlookup and it took what appeared (to me) an extremely long time.  Thanks for the heads up on INDIRECT.EXT.  I've been looking for opportunities to write my "first" DLL/COM using VS but not sure a rewrite of INDIRECT.EXT is first on my list, but its on the list, lol... However, writing THREE-D's is as there are definitely problems with that particular function in the same library

:P

Dave
0
 
LVL 14

Expert Comment

by:Zack Barresse
ID: 37804174
All I can say is, good luck!  :)

Zack
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now