Between calculations

D

Dan Wilson

Good day. I am using Excel 2002. I have a need to
calculate shipping charges based on four parameters. The
table is as follows;

000.00 - 249.99 = 7.00
250.00 - 499.99 = 10.00
500.00 - 999.99 = 12.00
1000.00 and up = 15.00

There will be one cell that will hold the total product
cost. If necessary, a separate worksheet can be generated
to hold a table for the four parameters.

I have tried several combinations and don't seem to be
getting the right one. Please advise.

Thanks, Danno...
 
G

GOD

Dan Wilson said:
Good day. I am using Excel 2002. I have a need to
calculate shipping charges based on four parameters. The
table is as follows;

000.00 - 249.99 = 7.00
250.00 - 499.99 = 10.00
500.00 - 999.99 = 12.00
1000.00 and up = 15.00

There will be one cell that will hold the total product
cost. If necessary, a separate worksheet can be generated
to hold a table for the four parameters.

I have tried several combinations and don't seem to be
getting the right one. Please advise.

Thanks, Danno...

I'm not exactly certain how to do the actual math of it, but I think what
you are looking for are nested functions, basically the first one asks is x
greater than 1000, y/n... if y then value z is 15, if not then is value x
greater than 500? y/n, is yes then value z = 12, if no .. and so on...
 
B

Biff

Hi!

Here's one way:

Assume cell A1 is the total cost.

=IF(A1="","",LOOKUP(A1,{0,250,500,1000},{7,10,12,15}))

Format the cell as NUMBER 2 decimal places.

Biff
 
S

Sandy Mann

Dan,

With your data (weights?) in E6 try

=IF(ISNUMBER(E6),SUM((E6>={250,500,1000})*3)+(E6<500)+6,"")

to give the appropriate 7, 10, 12 or 15

If it is to be part of the shipping charge calculation then use:

=IF(ISNUMBER(E6),SUM((E6>={250,500,1000})*3)+(E6<500)+6,0)* <Your charge>

HTH

Sandy
 
S

Sandy Mann

Biff said:
Hi!

Here's one way:

Assume cell A1 is the total cost.

=IF(A1="","",LOOKUP(A1,{0,250,500,1000},{7,10,12,15}))

Format the cell as NUMBER 2 decimal places.

Biff

Where did that post come from? It wasn't there when I looked 10 minutes ago
<g>


Sandy
 
D

Dan Wilson

Good day Sandy. All I can say is WOW!!! I tried your
formula in my worksheet and it works! That is not because
I am surprised, but because I thought I was good at math
and formulas. You have just set me back several steps. I
will be sending quite a bit of time evaluating this
formula to try and understand how it works. Thanks again,
Danno...
 
S

Sandy Mann

Dan,

It may be a good exercise but I like Biff'solution better. If I had seen it
before I posted I would never have posted.

Regards

Sandy
 
D

Dana DeLouis

Just some more fun options:
=3*(A1>=1000)+2*(A1>=500)+3*(A1>=250)+7*(A1>0)

Usually shorter the other way around:
=15 -3*(A1<1000)-2*(A1<500)-3*(A1<250)

Another variation along Dan's excellent formula:
=MOD(2922,9+SUM((A1>={0,250,500,1000})*2))
 
D

Dana DeLouis

Hi Sandy. This isn't to useful here, but you might be interested in another
option.
I can never do this from inspection of the data. If you treat the data
table as a Signal pulse, and take the Inverse Fourier Transform, you arrive
at the following suggestion:

=(1/2)*(3*SIGN(A1-999.999)+2*SIGN(A1-499.999)+3*SIGN(A1-249.999)+22)

Do to the nature of the data ranges, a small delta time delay is added.
The reason I mention it is that in VBA, the following equation:

ans=(1/2)*(3*Sgn(t-999.999)+2*Sgn(t-499.999)+3*Sgn(t-249.999)+22)

is about 52 times faster then this equation (based on my timing tests):

ans=WorksheetFunction.Lookup(t,Array(0,250,500,1000),Array(7,10,12,15))

Again, just thought you might find it interesting. :>)
 
S

Sandy Mann

Dana DeLouis said:
Hi Sandy. This isn't to useful here, but you might be interested in another
option.
I can never do this from inspection of the data. If you treat the data
table as a Signal pulse, and take the Inverse Fourier Transform, you arrive
at the following suggestion:

=(1/2)*(3*SIGN(A1-999.999)+2*SIGN(A1-499.999)+3*SIGN(A1-249.999)+22)

Oh! come on Dana I'm a simple bicycle repair man - although it is true that
at school I was compared to Einstein - the teacher said to my parents, "Well
he's no Einstein!"

Re-arranging your truly excellent formula gives:

=SIGN(A1-499.999)+1.5*(SIGN(A1-249.999)+SIGN(A1-999.999))+11

which still seems to work, at least like your original, for whole numbers.

Regards

Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top