How to handle variable formulas in a table?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,691
Office Version
  1. 365
Platform
  1. Windows
Is there a good way to handle a situation in a table when the formulas in one or more columns vary from row to row?

This little table that compares the cost of candy bars has 2 records.
  • In row 7, the large (49g) bars come 18 to a box. The weight of the box is not given.
  • In row 8, the small (17g) bars come in a 320g bag. The number of bars is not given.
I want to compare the cost/bar and the cost/17g of the candy. To do that, I need the total weight of the order and the number of bars.
  • Column E has the weight of each package (box or bag). In E7 it is calculated. In E8 it is given.
  • Column F has the number of bars/package. In F7 it is given. In F8 is it calculated.
If I add a row, I need to pick one of these 2 package types. Is there a way to do that in one table or am I trying to compare apples and oranges?

What if I add another field, maybe something like "Wt Type", which I could set to "Bag" or "Bar" to indicate what the weight applies to and then modify the formulas based on that?

Should I make two separate tables? If I do, how can I make the last 2 comparisons (columns K & L)?

$Table Test.xlsx
CDEFGHIJKL
5BarsPackageThis Order
6ProductWt/BarWt/PkgBars/Pkg#Pkgs#BarsWtPrice$/Bar$/17g
7Box of 36 large bars49g1,764g361361,764g$33.11$0.92$0.32
82 bags of small bars17g320g18236640g$15.88$0.44$0.44
Test
Cell Formulas
RangeFormula
E7E7=[@[Wt/Bar]]*[@[Bars/Pkg]]
H7:H8H7=[@[Bars/Pkg]]*[@['#Pkgs]]
I7:I8I7=[@[Wt/Pkg]]*[@['#Pkgs]]
K7:K8K7=[@Price]/[@['#Bars]]
L7:L8L7=[@[$/Bar]]/([@[Wt/Bar]]/17)
F8F8=ROUNDDOWN([@[Wt/Pkg]]/[@[Wt/Bar]],0)
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
The simplest I can think of is to put the formula into the whole of column E, and if you want to specify a fixed weight, just type it in.
Or you could include a column where you can put in a fixed weight, if applicable. then the next column uses this, but if not provided, it calculates it.
 
Upvote 0
The simplest I can think of is to put the formula into the whole of column E, and if you want to specify a fixed weight, just type it in.
Or you could include a column where you can put in a fixed weight, if applicable. then the next column uses this, but if not provided, it calculates it.
I tried that. Depending on where the row is that I modify, it seems to change how the table adds subsequent new rows. I haven't quite figured out the algorithm the table used. It seems like it stores the formula outside the table.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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