Boilermaker24
New Member
- Joined
- Apr 15, 2018
- Messages
- 1
Hi Everyone,
I am working on a problem to update pricing throughout a database of about 800 parts. After looking around online, I think Solver is the best way to approach this problem, but I couldn't find any VBA code to execute this.
Here are the rules (also illustrated below)
Primary Logic: 15% <= Core <= 35% Re Price
Secondary Logic: 85% <= Re Price + Core Price <= 95% Original Price
I pulled the data from row 4 of the spreadsheet and included the formulas:
[TABLE="width: 762"]
<tbody>[TR]
[TD="align: right"][TABLE="width: 500"]
<tbody>[TR]
[TD]D (Original Price)[/TD]
[TD]G (Re Price)[/TD]
[TD]I (Old Core Price)[/TD]
[TD]T (Primary Low %)[/TD]
[TD]U (Primary High %)[/TD]
[TD]V (Secondary Low %)[/TD]
[TD]W (Secondary High %)[/TD]
[TD]X (Core)[/TD]
[TD]Y (Re + Core Price)[/TD]
[TD]Z (New Core)[/TD]
[/TR]
[TR]
[TD]$502.34[/TD]
[TD]$146.97[/TD]
[TD]$10.00[/TD]
[TD]$22.05[/TD]
[TD]$51.44[/TD]
[TD]$426.99[/TD]
[TD]$477.22[/TD]
[TD]$51.44[/TD]
[TD]$198.41[/TD]
[TD]$51.44[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]=G4*0.15[/TD]
[TD]=G4*0.35[/TD]
[TD]=D4*0.85[/TD]
[TD]=D4*0.95[/TD]
[TD][/TD]
[TD]=G4+X4[/TD]
[TD]=X4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
X4 <= U4
X4 >= T4
Y4 <= W4
Y4 >= V4
Changing Variable Cells: X4
Set Objective (Max): Z4
I am looking to replicate this down about 800 rows of data to find the max core price for each part given the constraints. I am not looking to manually update solver each time and was thinking there was a better way to do this through VBA.
Thanks,
Isaac
I am working on a problem to update pricing throughout a database of about 800 parts. After looking around online, I think Solver is the best way to approach this problem, but I couldn't find any VBA code to execute this.
Here are the rules (also illustrated below)
Primary Logic: 15% <= Core <= 35% Re Price
Secondary Logic: 85% <= Re Price + Core Price <= 95% Original Price
I pulled the data from row 4 of the spreadsheet and included the formulas:
[TABLE="width: 762"]
<tbody>[TR]
[TD="align: right"][TABLE="width: 500"]
<tbody>[TR]
[TD]D (Original Price)[/TD]
[TD]G (Re Price)[/TD]
[TD]I (Old Core Price)[/TD]
[TD]T (Primary Low %)[/TD]
[TD]U (Primary High %)[/TD]
[TD]V (Secondary Low %)[/TD]
[TD]W (Secondary High %)[/TD]
[TD]X (Core)[/TD]
[TD]Y (Re + Core Price)[/TD]
[TD]Z (New Core)[/TD]
[/TR]
[TR]
[TD]$502.34[/TD]
[TD]$146.97[/TD]
[TD]$10.00[/TD]
[TD]$22.05[/TD]
[TD]$51.44[/TD]
[TD]$426.99[/TD]
[TD]$477.22[/TD]
[TD]$51.44[/TD]
[TD]$198.41[/TD]
[TD]$51.44[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]=G4*0.15[/TD]
[TD]=G4*0.35[/TD]
[TD]=D4*0.85[/TD]
[TD]=D4*0.95[/TD]
[TD][/TD]
[TD]=G4+X4[/TD]
[TD]=X4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
X4 <= U4
X4 >= T4
Y4 <= W4
Y4 >= V4
Changing Variable Cells: X4
Set Objective (Max): Z4
I am looking to replicate this down about 800 rows of data to find the max core price for each part given the constraints. I am not looking to manually update solver each time and was thinking there was a better way to do this through VBA.
Thanks,
Isaac