Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Excel 2007 - how to insert cell value into a formula

Posted on 2011-10-14
8
Medium Priority
?
284 Views
Last Modified: 2012-05-12
I've got the following formula in an Excel 2007. I don't know VBA.

=VLOOKUP(F43,[FileName.xls]C16!$H:$U,14,FALSE)

I'd like for the C16 part of the formula above to be a variable, so that a cell a couple of columns to the left, C43, dictates the worksheet within the file FileName.xls containing the table array for this VLOOKUP.

Is this possible? If so, please teach me how.
0
Comment
Question by:SolidGold
  • 5
  • 3
8 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 36971146
Like this (assuming it's C43 in the same sheet):

Range("A1").Formula = "=VLOOKUP(F43,[FileName.xls]" & Range("C43").Value & "!$H:$U,14,FALSE)"
0
 
LVL 1

Author Comment

by:SolidGold
ID: 36971183
Thanks for the quick reply StephenJR!

Can you dumb it down for me a tad?

Should I be able to copy/paste what you've provided into my formula?
=VLOOKUP(F43,[FileName.xls]" & Range("C43").Value & "!$H:$U,14,FALSE)

I'm unfamiliar with some of the ideas you're using in there, like Range, Formula and Value.
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36971216
Apologies, I misread and thought you wanted VBA. This formula should work in whatever cell you want:

=VLOOKUP(A2,INDIRECT(C43 & "!$H:$U"),14,FALSE)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 total points
ID: 36971222
Let's try again, for your example:

=VLOOKUP(F43,INDIRECT("[FileName.xls]" & C43 & "!$H:$U"),14,FALSE)
0
 
LVL 1

Author Comment

by:SolidGold
ID: 36971254
Still struggling, StephenJR...

Where does your formula define the the workbook where the table array is located? I was using [FileName.xls] in my example.

The VLOOKUP table array is in a separate workbook file, in case I didn't make that clear.
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36971265
So what exactly is in C43? I was just following your example, you can use any workbook name.
0
 
LVL 1

Author Comment

by:SolidGold
ID: 36971292
Apologies, Stephen, I posted my comment about defining the workbook before I saw your follow up comment that included [FileName].xls.

Your formula works. Thank you!
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36971311
My pleasure.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

581 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