Defined Name Error

Logo

New Member
Joined
Jul 28, 2010
Messages
5
Hello All,

I'm going to try and clearly explain my problem and the methodology I'm using. However, bear with me if there is any ambiguity.

I'm using excel 2007 and my goal is to vlookup salary data from a named range on another worksheet using job titles. I have defined the name as such:
"=OFFSET('SALARY DATA'!$A$3,0,0,COUNTA('SALARY DATA'!$A$3:$A$5000),4)"

I have three similar tables representing different classifications of employees and I need to vlookup the from the correct table. Therefore, my vlookup has some additional logic:
"=VLOOKUP(H2,IF(F2="EXPAT",INDIRECT(F2&"s"),INDIRECT(F2&LEFT(G2,1))),2,FALSE)"

The vlookup evaluates to a #REF error. However, if I hardcode the named range i.e. 'SALARYDATA'!$A$3:$D$200 the formula works correctly. Why does the INDIRECT portion of the formula fail when I create a dynamically named range?

Any pointers or possible solutions would greatly be appreciated.

Thanks,
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hello All,

I'm going to try and clearly explain my problem and the methodology I'm using. However, bear with me if there is any ambiguity.

I'm using excel 2007 and my goal is to vlookup salary data from a named range on another worksheet using job titles. I have defined the name as such:
"=OFFSET('SALARY DATA'!$A$3,0,0,COUNTA('SALARY DATA'!$A$3:$A$5000),4)"

I have three similar tables representing different classifications of employees and I need to vlookup the from the correct table. Therefore, my vlookup has some additional logic:
"=VLOOKUP(H2,IF(F2="EXPAT",INDIRECT(F2&"s"),INDIRECT(F2&LEFT(G2,1))),2,FALSE)"

The vlookup evaluates to a #REF error. However, if I hardcode the named range i.e. 'SALARYDATA'!$A$3:$D$200 the formula works correctly. Why does the INDIRECT portion of the formula fail when I create a dynamically named range?

Any pointers or possible solutions would greatly be appreciated.

Thanks,
The problem is that INDIRECT won't work if the named ranges are defined using functions like OFFSET.

What are the names of the ranges in question?

What are the possible entries for cell F2?

What's in cell G2 and what are the possible entries in cell G2?

You should be able to make this work using a combination of MATCH and CHOOSE but we need to narrow down all the possible range names and when to use a particular named range.
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,652
Members
452,934
Latest member
mm1t1

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