38
votes

I'd like to know how to pull cell references from the value of another cell and insert them into a formula.

For a simple example:

In cell A1 I have this: COUNT(B4:H4)

Instead of choosing the range when I set up the formula, I'd like this range to be dynamic, based on the value in other cells.

So, I want to type in cell references: in cell B4, I'd type in C5, and in H4 I'd type in C8. How can I set up my formula to look inside cells B4 and H4, but then return the range that is defined by the values in these cells (C5:C8 in this case...) So in the end, cell A1 would return the count of C5:C8

I hope that makes sense. It seems like something pretty simple but I can't seem to find info on it. Thanks in advance.

1
I'm not sure I understand, do you mean you want the sum of C5:C8 in cell B4? I got lost when you said "then return the range that is defined by the values in these cells" You want a cell to return a range?just eric
Sorry, I just edited to clarify. I want the count of C5:C8 in cell A1. I want my formula to be pointing to cells B4 and H4 which will actually contain the text "C5" and "C8", respectively.KrazyKiddo8

1 Answers

56
votes

Use INDIRECT()

=SUM(INDIRECT(<start cell here> & ":" & <end cell here>))