Better Formula for sheet/range referencing

XL Pro

Board Regular
Joined
Apr 17, 2002
Messages
235
MyReport.XLS
ABCDE
7TotalsHOURS WORKED AT:
8ForSTRAIGHTOVERDOUBLE
9Job Class:TemplateTIMETIMETIME
10CMPCAD21E21F21
11CLICF21G21H21
12PHPJCMPCA---
13PHPJDuesCMPCA---
14JRNFUSCMPCA---
15PHFCLIC---
Totals


Column A has the sheet names
Column B has the type of template
Rows 10/11 has the type of template/ranges to reference.

the formulas in C12:E15 looks as such:
Code:
=IF(ISERROR(INDIRECT($A13&"!"&VLOOKUP($B13,$B$10:$AA$11,COLUMN(B$1),FALSE))),0,INDIRECT($A13&"!"&VLOOKUP($B13,$B$10:$AA$11,COLUMN(B$1),FALSE)))

I need to reference the cells in row 10 or 11 in the sheet in column A based on the template in column B.

Is this the best formula, or can it be better written. I'm specifically looking at the VLOOKUP() part of the formula.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,726
Maybe...

=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,INDIRECT($A13&"!"&VLOOKUP($B13,$B$10:$AA$11,COLUMN(B$1),0))))

...which will return 0 when there's no match for VLOOKUP or when the specified sheet doesn't exist.

Hope this helps!
 

XL Pro

Board Regular
Joined
Apr 17, 2002
Messages
235
What's the purpose of the 9.99999999999999E+307 in the formula?
 

Forum statistics

Threads
1,141,681
Messages
5,707,791
Members
421,527
Latest member
Tamiwsw

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
Top