Vlookup function macro

J

Jack

i have a series of tables that i need to select from, Below is a sample of
the if statement i have written. I need to copy this to multiple cells. Is
there a way to write a function macro to do the same thing?

=IF($O18=5,VLOOKUP(RateSheetDate,Table_PF_G5_T1,4),IF($O18=6,VLOOKUP(RateSheetDate,Table_PF_G6_T1,4),IF($O18=7,VLOOKUP(RateSheetDate,Table_PF_G7_T1,4),IF($O18=8,VLOOKUP(RateSheetDate,Table_PF_G8_T1,4),0))))
 
E

Elkar

You may not need a macro. See if this works for you:

=VLOOKUP(RateSheetDate,INDIRECT("Table_PF_G"&$O18&"_T1"),4)

The INDIRECT function allows you to create a dynamic range reference based
upon the value in cell O18.

HTH
Elkar
 
J

Jack

Works great - Thanks

Elkar said:
You may not need a macro. See if this works for you:

=VLOOKUP(RateSheetDate,INDIRECT("Table_PF_G"&$O18&"_T1"),4)

The INDIRECT function allows you to create a dynamic range reference based
upon the value in cell O18.

HTH
Elkar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top