Better Formula for sheet/range referencing

XL Pro

Board Regular
Joined
Apr 17, 2002
Messages
249
Office Version
  1. 365
Platform
  1. Windows
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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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!
 
Upvote 0
What's the purpose of the 9.99999999999999E+307 in the formula?
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,981
Members
448,538
Latest member
alex78

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