Have one cell represent a cell range

2019-01-28 03:56发布

问题:

Excel 2003 Question:
I'd like to have one cell represent a range of cells. So that another formula can use it.

Right now, I have an equation to sum the hours worked on a specific project. It looks for a project name, and then beside it, I have a column with how long i've spent on it. This is the formula =SUMIF(D1:D10,"project1",C1:C10)

If you look at the first picture,
I want B10 to say the range of Duration (B23-B28)
I want C10 to say the range of Project (C23-C28)

Now look at the second picture, with the formula.
Instead of having the range manually, I just want it to look at B10, and C10 so I get the range once. This way, I only have to change the range in one spot instead of how ever many projects I have.

I'm sorry if this is a messy problem. I'm not sure how to ask it, but I will be quickly answering comments if people aren't clear on what I'm trying to accomplish.



回答1:

Making it a bit more clear. You can enter the range (Address) as a text in the cells, and then use INDIRECT to reference them to a range instead of just text.

So enter

"C23:C46" in cell B10 (without quotes)
"D23:D46" in C10      (without quotes)

and use INDIRECT in your formula for SUMIF
Here's a picture for more clarity.



回答2:

Store in the cell the address as mere text.

When using that range, use INDIRECT(B10).

See Excel DSUM with multiple criteria for a somewhat more complex usage example.