How to sum a column - minus one row , to avoid circular calculations ?

StrawberryDreams

Board Regular
Joined
Mar 26, 2022
Messages
79
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
Basic data calculator test 8c.xlsm
DEFGHIJKLM
221Using the Selection Entry Table, the user picks both the Season and Target Product, then enters an amount ( number of items )
232The Selection Entry Table will take the item value from the Inventory Table using Index/Match which it does already and ( multiplies the value by the Amount in the Entry table ) and assigns that number to the product column which matches with the season and product dropdown.
243I would like the Remaining Target Value to be the Indexed value from the Yearly goal table ( which it does based on matching product with the entry table Target Product)
25and subtract the corresponding column total ( one row above ) so that it doesn’t include itself in a circular calculation.
26If possible, the Remaining Target Value in yellow should be ( = 200 - 60 = 40 remaining) before entering a value in Amt. needed.
27
284IF a value of "1" is entered in the Amt. then the grand total for pants will be 70 but the remaining target value should then be 200 - 70 = 30, but this might cause a circular reference ?
test sheet (3)





Basic data calculator test 8c.xlsm
EFGHIJKLM
2YearlyGoalInventoryTableItem Value
3ProductYearly Target ValueOutfit NameShirtPantsHatDress Gloves
4Shirt100Summer1010101010
5Pants200Fall2020202020
6Hat150Winter3030303030
7Dress300Spring4040404040
8Gloves100
9
10
11Grand Total >>06010060
12SelectionEntry
13Remaining Target ValueAmt neededChoose SeasonTarget ProductShirtPantsHatDressGloves
142001FallPants 20   
151501SummerHat  10  
162001SpringPants 40   
171002WinterGloves    60
18200SummerPants 0   
19      
test sheet (3)
Cell Formulas
RangeFormula
I11I11=SUM(SelectionEntry[Shirt])
J11J11=SUM(SelectionEntry[Pants])
K11K11=SUM(SelectionEntry[Hat])
L11L11=SUM(SelectionEntry[Dress])
M11M11=SUM(SelectionEntry[Gloves])
I14:I19I14=IF([@[Target Product]] = SelectionEntry[[#Headers],[Shirt]], [@[Amt needed]]* (INDEX(InventoryTable1825[[#All],[Shirt]],MATCH([@[Choose Season]],InventoryTable1825[[#All],[Outfit Name]],0))),"")
J14:J19J14=IF([@[Target Product]] = SelectionEntry[[#Headers],[Pants]], [@[Amt needed]]* (INDEX(InventoryTable1825[[#All],[Pants]],MATCH([@[Choose Season]],InventoryTable1825[[#All],[Outfit Name]],0))),"")
K14:K19K14=IF([@[Target Product]] = SelectionEntry[[#Headers],[Hat]], [@[Amt needed]]* (INDEX(InventoryTable1825[[#All],[Hat]],MATCH([@[Choose Season]],InventoryTable1825[[#All],[Outfit Name]],0))),"")
L14:L19L14=IF([@[Target Product]] = SelectionEntry[[#Headers],[Dress]], [@[Amt needed]]* (INDEX(InventoryTable1825[[#All],[Dress ]],MATCH([@[Choose Season]],InventoryTable1825[[#All],[Outfit Name]],0))),"")
M14:M19M14=IF([@[Target Product]] = SelectionEntry[[#Headers],[Gloves]], [@[Amt needed]]* (INDEX(InventoryTable1825[[#All],[Gloves]],MATCH([@[Choose Season]],InventoryTable1825[[#All],[Outfit Name]],0))),"")
E14:E19E14=IFERROR(INDEX(YearlyGoal[[#All],[Yearly Target Value]],MATCH([@[Target Product]],YearlyGoal[[#All],[Product]],0)),"")
Cells with Data Validation
CellAllowCriteria
G14:G20List=$H$4:$H$7
H14:H19List=$E$4:$E$8
 
Last edited:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Looking for a formula to provide the results in Column A. Column B allows a dropdown to select which column you want the formula to apply to in Column A.

I guess I'm kinda after a running total that Sum's an indexed column, but everything one row above from itself. I have written the values in Column A for what I want it to look like.

Basic data calculator test 8c.xlsm
ABCDEF
1SUM of chossen target column of all rows above the target row In the target rows columntarget to chooseAB CD
20A1010
315C1515
415B201020
530A1010
620D30
740A1520
Sheet15
Cells with Data Validation
CellAllowCriteria
B2:B7List=$C$1:$F$1
 
Last edited:
Upvote 0
How did you get 10 for the first A when there's no row above?
 
Upvote 0
How did you get 10 for the first A when there's no row above?
I fixed that.... Human error... none of the cells have any formulas... It was just quickly written as to what I want it to do. Nice catch !!
 
Upvote 0
Thanks for confirming. Try this.
Book1
ABCDEF
1target to chooseABCD
20A1010
310C15
415B201020
530A1010
620D30
740A1520
Sheet7
Cell Formulas
RangeFormula
A2:A7A2=IFERROR(SUM(DROP(CHOOSECOLS($C$2:F2,MATCH(B2,$C$1:$F$1,0)),-1)),0)
 
Upvote 0
Solution
Thanks for confirming. Try this.
Book1
ABCDEF
1target to chooseABCD
20A1010
310C15
415B201020
530A1010
620D30
740A1520
Sheet7
Cell Formulas
RangeFormula
A2:A7A2=IFERROR(SUM(DROP(CHOOSECOLS($C$2:F2,MATCH(B2,$C$1:$F$1,0)),-1)),0)
This will be great thanks Cubist. Gonna plug it in and start to modify as needed. Woohoo a new excel function I've never used yet ( choose column)
 
Upvote 0

Forum statistics

Threads
1,224,879
Messages
6,181,531
Members
453,054
Latest member
ezzat

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