View Single Post
jyl jyl is online now
Registered
 
jyl's Avatar
 
Join Date: Jan 2002
Location: Nor California & Pac NW
Posts: 24,863
Garage
Basically you want to do something like

=IF([cell reference]="NY",[formula w/ sales tax],[formula w/o sales tax])

For example

=IF(A10="NY",B10*1.06,B10)

But you have to charge sales tax in three states, NY SC and OH? If it is the same tax rate in all states, then try

=IF(OR(A10="NY",A10="SC",A10="OH"),B10*1.06,B10)

If there is a different tax rate in each state, you can used nested IFs or a VLOOKUP table.

Nested IFs would be like

=IF(A10="NY",B10*1.06,IF(A10="SC",B10*1.065,IF(A10="OH",B10*1.07,B10)))

Nested IFs are ugly, so personally I would set up a 2-col x 3-row table with NY SC OH down one column and 1.06 1.065 1.07 down the other column. Suppose that table is located in cells I23:J25. Then

=IF(ISERROR(VLOOKUP(C23,$I$23:$J$25,2,FALSE)),1,VL OOKUP(C23,$I$23:$J$25,2,FALSE))

will give you 1.06 if C23 is "NY", 1.065 if it is SC, 1.07 if it is OH, and 1 if it is anything else.

The VLOOKUP approach lets you easily change the tax rates, add more states to tax, etc, and is way easier to read and debug than yucky nested IFs.

P.S. Wow, no shortage of responses, all posted while I was typing mine. Randy's formula needs a term telling it what to return if none of the IFs are true, i.e. if the state is not NY SC or OH, that is probably why you are getting the "False".

PM me your email and I will email you the spreadsheet I did to test the VLOOKUP method I posted.
__________________
1989 3.2 Carrera coupe; 1988 Westy Vanagon, Zetec; 1986 E28 M30; 1994 W124; 2004 S211
What? Uh . . . “he” and “him”?

Last edited by jyl; 01-30-2007 at 07:20 PM..
Old 01-30-2007, 07:14 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #15 (permalink)