Forum Discussion

Jonathan_Naismith's avatar
Jonathan_Naismith
Copper Contributor
Oct 03, 2023

Excel - using text inside one cell to define column in formula

Hi,

I have a spreadsheet with a load of passenger numbers, rows are the individual routes, columns are the dates. this is updated regularly as we proceed through the year.

Not all dates are used, only weekdays and then sometimes specific dates are not used.

I need to produce monthly averages, min, max etc on each of the routes.

Some routes use two rows, some only the one. (if they were all the same then I could just fill down the formula, but this is not the case. )

I want to define in two cells the first column letter to use and the last. So I can easily change the month I wish to calculate.

I then want the formula to reference this cell when doing the calculations but the row number would stay the same. 

I have tried using INDIRECT, but it never seems to work.

If I use the following I get a #ref error

=AVERAGE(INDIRECT("&DF31&""5:P6"))

In my eyes, DF31 is a cell that contains the letter N, so the indirect should pull through that N, then add the 5 on the end to give the correct cell to start from. 

I would want the P in the formula to also be brought in from cell DG31

Any help would be very much appreciated. 

Resources