# Better Formula for sheet/range referencing

#### XL Pro

##### Board Regular
MyReport.XLS
ABCDE
7TotalsHOURS WORKED AT:
8ForSTRAIGHTOVERDOUBLE
9Job Class:TemplateTIMETIMETIME
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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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!

What's the purpose of the 9.99999999999999E+307 in the formula?

Have a look at Aladin's explanation here...

Thanks, that explains everything!

Replies
10
Views
442
Replies
4
Views
364
Replies
12
Views
623
Replies
4
Views
230
Replies
1
Views
304

1,219,905
Messages
6,150,903
Members
450,991
Latest member
ExcelDoer

### 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.

### Which adblocker are you using?

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

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