简体   繁体   中英

How to use a cell's text in a formula?

My Excel file has eight different worksheets. Seven of them are named to the days of the week ("Monday", "Tuesday", etc.). The last worksheet, called "Week" should provide some general data, based on these days.

In the first column of "Week", I typed the days of the week, so A1: Monday , A2: Tuesday , etc. In the second column, I'd now like to add a formula that uses data from the worksheet of the corresponding day. For example: B1: =SUMIF(Monday!C1:C4;mycondition;Monday!D1:D4) , B2: =SUMIF(Tuesday!C1:C4;mycondition;Tuesday!D1:D4) , etc. This works fine, but I don't want to type the days of the week all over again.

Is it possible to use the text of the cells A1-A7 in "Week" in these formulas? I tried =SUMIF(A1!A1:A4;mycondition;A1!B1:B4) , but that didn't work.


Note: If I should add a new row to one of the "day" worksheets, the cell references in the formula in "Week" should be changed too. =SUMIF(INDIRECT(A1&"!C1:C4");mycondition;INDIRECT(A1&"!D1:D4")) isn't what I'm looking for, because it fixes C1:C4 and D1:D4 .

Use INDIRECT function:

=SUMIF(INDIRECT(A1&"!$C:$C");mycondition;INDIRECT(A1&"!$D:$D"))

(I'm not sure if the syntax is correct (,/;), I dont't have an English Excel version.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM