Friday, October 21, 2011

Excel Indirect function

I just used Excel today to make some reports and this is a simple form or the function I made:

=INDIRECT("'" & D4 & "'!" & C4)

If you put the values from D4 and C4 into their places it looks like this: =INDIRECT("'test'!a1").
What this does is print what ever is in A1 of the test sheet. What is nice is it looks at a cell in the spreadsheet to choose the sheet to look for values in. So you could have a dropdown box show a list of the sheet names that you get from a settings sheet that you update each time you add a sheet. Then you can make reports that will update for you every time you change what is in the dropdown menu. I also use vlookups to lookup exactly what ranges to use in the dynamic indirect function. That way you can put most of the function code in one place in the table that the vlookup looks at instead of putting all the index or match function text in every place that uses the indirect function. I was having the vlookup table calculate what row each section start of stops so we can do a count of cells within that section from the indirect function without all the overhead that the vlookup table does.

No comments: