Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a pricelist 1

Status
Not open for further replies.

gusperry

IS-IT--Management
Aug 15, 2000
14
0
0
US
I'm working on setting up a corporate software that I would like to include a calculator for our pricing guide. This pricing guide will have atleast 3 dimensions (maybe 4). EX:

What Material, How Thick, How tall, Painted/Unpainted(yes/no).

This pricing guide breaks down in this order:
material, thickness, paint, height... from that information, you can get a final price on an indevidual product.

I'm wondering if there is a function for using that many dimensions to call a single number that has no mathmatic properties (ie. =((thickness)x(height))/(painted), and does anyone have any thought as to how to layout a table(s) of this nature.
 
Well thats a straight forward setup I think you are making it more difficlut than it is.

As far as a function goes, make your own that's where VBA really shines.

Start out but going to the "modules" TAB and click the "New" button. Then click "Insert" menu and "Procedure"
In the "Type" section make sure the "Function" radio button is checked.
Now think of a name...
For mine I'll use "Sample"

So you should see something like so:
----------------------------
Public Function Sample()

End Function
-----------------------

Now then you need to pass your 4 parameters
So inside the Parenthesis put 4 variables separated by commas like this.
Public Function Sample(Material, Thickness, HowTall, Painted)

Next you do your calculations
Dim a as Variant
a=((Thickness)x(HowTall))/(Painted)
' Or whatever, you can do as much as it takes
then when you have your final answer pass it back to the functions name like so
-------------------- This is the whole thing put together --------
Public Function Sample(Material, Thickness, HowTall, Painted)
Dim a As Variant
' Do whatever calculations here or
' You can open a table and get values too.
' you can do whatever it takes to get your answer
a = ((Thickness) * (HowTall)) / (Painted)
Sample = a ' Pass final answer back to Function name
End Function

Call your function like so
Somevalue = Sample("Aluminum", 0.500, 48, "Yes")

OK
 
Thank you very much for the responce, it's very helpful. Also, I must say, your sample values are acually part of our product line, fancy that. the value would have been $675 per unit, the MOST expencive single unit in our catalog. psychic programming, very fancy.
Thanks Again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top