Search This Blog

Friday, July 20, 2012

Excel Tip of the Day: INDIRECT

The INDIRECT function is a pretty hard function to understand at first glance. However all you need to know is this

1) It converts a string into a cell Reference
2) It does not work with named formula
3) INDIRECT is a volatile function
4) It is often used in conjuction with the function ADDRESS


 1) It converts a string into a cell Reference


 =INDIRECT("A1")

Is equivalent to a foruma =A1

=INDIRECT("TblOrders")

it gives you back a reference to the TblOrders Table. This is Equivalent to a formula =TblOrders
The advantage is that you can form the string using formulas to make dyamically build reference to table objects


2) INDIRECT does not work with named formula

if you have a named formula like   myrange  =OFFSET($A$1,1,0,COUNTA($A:$A)-1,1)
and then you use =INDIRECT("myrange") this will not be equivalent to =myrange.

However if you do something like myrange = $A$3:$C$10
and then you type =INDIRECT("myrange") this will work fine and will be equal to =myrange

This means that if you are trying to use in a list validation INDIRECT(C3) where C3="mylist" and
mylist  = OFFSET($A$1,1,0,COUNTA($A:$A)-1,1),
this dynamic validation procedure will fail - INDIRECT is poiting to a named formula

You will instead need to use something like

 C3 = "mylistheader", whe mylistheader is a named cell,
mylistheader = $A$1.
mylistheadeCol = $A:$A

OFFSET(INDIRECT(C3),0,0,COUNTA(INDIRECT(A1&"Col")),1)

INDIRECT(C3) = a referece to $A$1
COUNTA = will count the name in the list

This will work just fine

3) INDIRECT is a volatile function

This mean that Excel recomputes it each time it recalculate the spread sheet. It make the spreadsheet very heavy. Use it sparingly.

4) It is often used in conjuction with the function ADDRESS
    to dynamically build range reference 

No comments:

Post a Comment