Автозаполнение по разделам или по условию на другую ячейку

331
David

У меня есть данные, которые выглядят так:

Класс Дата Год1 Год2 СезонностьИндекс AUS 9 августа 1 0 0.060465116 16 августа 2016 г. 0 0.362790698 AUS 23 августа 2 1 0.181395349 BVE 9 августа 2000 года? 

Я хочу автоматически заполнить столбец индекса сезонности. Тем не менее, код для этих ячеек выглядит так:

=(D55+E55)/SUM($D$55:$E$67)*$H$1 

Где H1константа, но, как вы видите, каждый индекс зависит от суммы всех значений в этом классе для года 1 ( Yr1) и года 2 ( Yr2). Когда класс меняется, я хочу, чтобы автозаполнение изменилось на следующий раздел.

Очевидно, что обычное автоматическое заполнение не будет работать в этом случае, потому что ячейки заблокированы. Каждый раздел - ровно 13 строк, если это помогает.

0

2 ответа на вопрос

0
NZKate

I'm not sure if this will be workable for you, but you could try: 1.Name each range with the exact same name as the name of the class. 2. Replace the sum with: =(D55+E55)/SUM(INDIRECT(A55))*$H$1 assuming A55 is the cell with the name of the class in it.

Of course, naming the ranges first is a bit of a pain, depends how much you use this spreadsheet and whether it's being reused in the exact same format frequently.

0
G-Man

If you want an expression that evaluates to SUM($D$55:$E$67) when it’s evaluated on rows 55-67, and evaluates to SUM($D$68:$E$80) when it’s evaluated on rows 68-80, etc., use

SUM(OFFSET($D$3, 13*INT((ROW()-3)/13), 0, 13, 2)) 

(Insert this into your full formula.)  Row numbers 55 through 67 get converted to 52 through 64 (by subtracting 3), which yield 4 through 4.923 (by dividing by 13), all of which get converted to 4 by INT().  Then multiply by 13, to get back up to 52, and use that as an offset to D3 to get up to D55.


Or, to add the values in Columns D and E for rows having the same value in Column A as the current row, use

(SUMIF($A$1:$A$999, $A1, $D$1)+SUMIF($A$1:$A$999, $A1, $E$1)) 

which does pretty much exactly what I just described.  Replace 1 and 999 with the range of rows in which you have class data.

It seems like it should be possible to combine the above into a single SUMIF (or maybe SUMIFS) that sums Columns D and E, but I couldn’t figure it out.

Похожие вопросы