2 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Advice on how to set up a dynamic calculator

Let’s say I need to price a bunch of milk. I have a set of variables like type (skim, 1%, 2%, whole), carton size (single serve, half gallon, gallon), dairy farm (private label, prairie farms, fairlife), and flavor (plain, chocolate, strawberry). I also have freight costs for dairy-to-customer delivery. Individual variables have an adder attached to them that needs to be accounted for when getting my final delivered cost.

I know I should probably use a system of dropdowns and xlookup for this, but I have another element of variables: I need to be able to look at the last 4 weeks of milk prices at the time of shipment and choose whichever price is lowest. I also different base prices depending on the dairy and milk type, like this:

BRAND 1 BRAND 2 BRAND 3
SKIM $1.50 $2.00 $1.75
1% $1.62 $2.50 $2.00
2% $1.75 $3.00 $2.25
WHOLE $2.00 $3.25 $3.15

I need the sheet to be able to find which base price it needs to use (while looking at the last 4 weeks’ prices) and then add the correct adders to get my final price. I already have a system set up to grab the last week’s prices and name a new tab after it after the day it was captured, and I’m trying to work on a macro that creates a function that will compare a certain cell over the last 4 tabs created and choose the lowest number. I just don’t know how to marry all this together and get it working.

Adders aren’t dynamic, they stay the same no matter what other variables are chosen (a 1% +$0.25 adder is the same no matter if I’m pricing a half gallon or full gallon).

I would be very thankful for any advice!!!

submitted by /u/denizene
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article