Excel基金行业权重汇总公式优化:新增行自动更新需求
Optimize Excel Weighted Average Formula for Auto-Update on New Rows
Your current formula relies on hard-coded cell references, which is why it fails to automatically include new rows when added. Here are two efficient, low-maintenance solutions to fix this:
Recommended: Use Excel Tables (Built-In Dynamic Ranges)
Excel Tables automatically expand to include new rows, so your formula will update without manual adjustments:
- Select your entire data range (including headers, e.g.,
B1:E17whereB1is "Weight" andC1/E1are industry names). - Press
Ctrl+T, check "My table has headers", then click OK. The range becomes a table (default name likeTable1). - In the cell below the table (originally
C18), enter this formula:
Replace=SUMPRODUCT(Table1[Weight], Table1[Industry 1])/SUM(Table1[Weight])Industry 1with the actual header name of column C. - Drag the formula across columns D, E, etc. Each column will reference its own industry header.
- Now, when you add a new row to the table (type below the last row or use Table Tools > Insert Row), the formula will automatically include the new row's data.
Alternative: Dynamic Range with SUMPRODUCT
If you prefer not to use tables, use a dynamic range that adjusts based on the position of your total row:
- In cell
C18, replace your existing formula with:=SUMPRODUCT($B$2:INDEX($B:$B, ROW($B$18)-1), C2:INDEX(C:C, ROW($B$18)-1))/$B$18 - Drag this formula across columns D, E, etc.
INDEX($B:$B, ROW($B$18)-1)targets the last row of data above your total row (B18). When you insert rows aboveB18,ROW($B$18)increases, expanding the range to include new rows.
Both methods replace your lengthy SUM of products with SUMPRODUCT, which is cleaner and more efficient for weighted calculations.
内容的提问来源于stack exchange,提问作者BadDogTitan
相关产品推荐
相关产品推荐

