Results 1 to 2 of 2

Thread: Equation Help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Equation Help

    Hi,

    My mind must be very tired today because I did this once but can't remember how I did it. I'm trying to take a price such as $100 and then back out the tax (say 6%) so the subtotal price plus the tax equals $100.

    In VB6 I want to write a function that I pass the total price of $100 and it returns the new price and the tax amount that totals $100.

    So as an equation, I write it as:

    $100 = Price + (Price * .06)

    If you just calculate the tax on $100 and subtract it, thats too much tax because the new price is lower that $100.

    Any thoughts?

    Thanks!!!

  2. #2
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    It's very simple:

    Price with tax = $100, tax = 6%.

    Price + 0.06 * Price = $100
    1.06 * Price = $100
    Price = $100 / 1.06 = $94.34 (approx)

    Generally: PriceWithoutTax = PriceWithTax / (1 + tax)


    Since $100 > $94.34, then if you take 6% from each, the 6% from $100 is also greater than the 6% from $94.34, so that's why you end with a value too low.
    I bet you ended up with $99.64 instead of $100.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width