Sum child cells and allow reference to higher cell within Table

babyjwhale

New Member
Joined
Nov 6, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have tried a number of formulas to get this, and I keep getting circular references. My use case is a construction project budget, where I have a hierarchy of categories. In a single table, I want to make the inputs AND see the rollup (I am familiar with PivotTables, and they do not fit this use because I need the rollup in the same table as the inputs). I want this to be an actual Table so that the automatic formulas populate when I add rows, as the individual project estimator may add unique detail rows to create the estimate.
Two examples:
1) Contractors charge a % fee on cost for their work. The % fee will be a top line item above their costs. As you'll see in the sheet, I reference their rolled up cost cell and multiply by a % to get the calculated value. This use works because this is a topline item referencing cells BELOW it that would cause a circular reference. I desire to do this with a bottom line item as described below.
2) After figuring all costs on the project, we apply a contingency factor based on the cost. Most often, this too is a % calculation. We show contingency at the bottom of the estimate, not at the top, so ideally this stays at bottom of my sheet. The issue I'm having is referencing a cell ABOVE this, though I'm using FILTER to cut the items that don't apply. I have tried using SUMIFS and SUMPRODUCT as well.
I intend to use LET and only show helper fields (next line level, kids check, and level check) to help visualize.

Look at the attached sheet and let me know if you have any ideas or solutions.

Using Excel 365 and ok using new formulas only available to subscribers.

Test File.xlsx is available for download *First post; forgive if it's preferred to use XL2BB instead of full files.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Welcome to the MrExcel board!

forgive if it's preferred to use XL2BB instead of full files.
XL2BB is preferred and likely better for you too since many of the helpers here choose not to download files from other sites or, due to security restrictions at their workplace, are unable to download such files.


In any case, your file link does not work for me (see below) so XL2BB might be better anyway. :)

1730975041435.png
 
Last edited:
Upvote 0
Test File.xlsx
DEFGHIJKLMN
2Overall Project Budget let helper let helper let helper
3LineLvlLine ItemQtyUnitUnit CostCalculatednext line lvlkid checklevel checkNote
411Total Project Cost3,235,0002TRUE0
522Hard Costs3,075,0003TRUE11
633Acquisitions1,500,0004TRUE6
744 Land Acquisition1LS1,000,0001,000,0004FALSE5
854 Building Acquisition1LS500,000500,0003FALSE6
963Construction1,575,0004TRUE11
1074 Contractor Fee0.05%1,500,00075,0004FALSE8This works b/c Line 8 is below.
1184 Cost of Work1,500,0005TRUE11
1295 Dirt Moving1LS500,000500,0005FALSE10
13105 Building Construction10,000SF1001,000,0002FALSE11
14112Soft Costs160,0003TRUE0
15123Design150,0004TRUE15
16134 Civil Engineering1LS50,00050,0004FALSE14
17144 Architect1LS100,000100,0003FALSE15
18153Contingency10,0004TRUE0
19164 Contingency (General)1LS10,00010,0004FALSE17
20174 Contingency, Acquisition0.05%--4FALSE18I want this to reference Line 3 [Calculated]
21184 Contingency, Construction0.05%--4FALSE19I want this to reference Line 6 [Calculated]
22194 Contingency, Design0.05%--0FALSE0I want this to reference Line 12 [Calculated]
Budget
Cell Formulas
RangeFormula
J4:J22J4=LET( next_line_level, INDIRECT(LEFT(ADDRESS(1,COLUMN([@Lvl]),4),1)&ROW([@Lvl])+1), kids_check, next_line_level>[@Lvl], level_check, MINIFS([Line],[Lvl],"<="&[@Lvl],[Line],">"&[@Line]), IFS( ISBLANK([@Lvl]),"INPUT LEVEL", kids_check=FALSE,[@Qty]*[@[Unit Cost]], level_check=0, SUMPRODUCT(FILTER([Calculated], ([Lvl]=([@Lvl]+1))*([Line]>[@Line]))), TRUE, SUMPRODUCT(FILTER([Calculated], ([Lvl]=([@Lvl]+1))*([Line]>[@Line])*([Line]<level_check)))))
K4:K22K4=INDIRECT(LEFT(ADDRESS(1,COLUMN([@Lvl]),4),1)&ROW([@Lvl])+1)
L4:L22L4=[@[next line lvl]]>[@Lvl]
M4:M22M4=MINIFS([Line],[Lvl],"<="&[@Lvl],[Line],">"&[@Line])
I10I10=J11
D4:D22D4=ROW()-ROW(Budget[[#Headers],[Line]])
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F4:F22Expression=$E4=4textNO
F4:F22Expression=$E4=5textNO
F4:F22Expression=$E4=6textNO
F4:F22Expression=$E4=7textNO
D4:N22Expression=$E4=1textNO
D4:N22Expression=$E4=2textNO
D4:N22Expression=$E4=3textNO
D4:N22Expression=$E4=5textNO
D4:N22Expression=$E4=6textNO
D4:N22Expression=$E4=7textNO
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:

There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:

There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
Thank you. I have not posted to another forum.
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,878
Members
452,486
Latest member
standw01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top