Solved

Referencing Another Tab Based on a Cell Value

Posted on 2013-11-08
6
171 Views
Last Modified: 2013-11-08
Hi I've inherited a spreadsheet with multiple tabs.   I am trying to break out the individual columns to individual tabs and then tie it into a backend.  I have the macro established to break it out into the individual tabs but am stumped on how to tie the backend into the individual tabs.  

I was wondering if there is a way to use a cell value to lead into the appropiate tab for a HLookup?

Thanks.
0
Comment
Question by:mattfmiller
6 Comments
 
LVL 12

Expert Comment

by:Harry Lee
Comment Utility
It really depends on what cell value you are referring to.

With If statement, and nested If statements, you can for sure do some sort of selection between which tab is used for the HLookup.

That also said, for sure you can do it in VBA.

What's the rule on which tab to use as the cell value change?
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
You can refer to a tab indirectly through a cell value using the INDIRECT() function

e.g. if you have a sheet named, MySheet, and you have a cell in the activesheet with text string in it as MySheet,  then you can reference that as =INDIRECT("'"&A1&"'!A1:A100)

this will refer to sheet shown in cell A1 and look at range A1:A100 in that sheet.
0
 
LVL 1

Author Comment

by:mattfmiller
Comment Utility
I think I'm partway there but I'm getting a reference error.

=HLOOKUP(E1,INDIRECT("'"&E2) & "!$B$1:$AZ$1000",2,0)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 23

Accepted Solution

by:
NBVC earned 225 total points
Comment Utility
Try:

=HLOOKUP(E1,INDIRECT("'"&E2&"'!$B$1:$AZ$1000"),2,0)
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 225 total points
Comment Utility
Try

=HLOOKUP(E1,INDIRECT("'"&E2 & "'!$B$1:$AZ$1000"),2,0)
0
 
LVL 1

Author Closing Comment

by:mattfmiller
Comment Utility
Thank you very much.  This is exactly what I needed.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

14 Experts available now in Live!

Get 1:1 Help Now