Consulting

Results 1 to 7 of 7

Thread: stamp duty tax

  1. #1

    stamp duty tax

    Hello,
    I want to be able to calculate the Stamp Duty tax In an easy way
    Shown below is the current rates Using this formula
    =IF(SUM(A2:D2)<=3000;"";IF(AND(SUM(A2:D2)>3001;SUM(A2:D2)<=3500);SUM(A2:D2)*1%;IF(AND(SUM(A2:D2)>3501;SUM(A2:D2)<=4000);SUM(A2:D2)*1.5%;IF(AND(SUM(A2:D2)>4001;SUM(A2:D2)<=4500);SUM(A2:D2)*2%;IF(AND(SUM(A2:D2)>4501;SUM(A2:D2)<=5000);SUM(A2:D2)*2.5%;IF(AND(SUM(A2:D2)>5001;SUM(A2:D2)<=5500);SUM(A2:D2)*3%;IF(AND(SUM(A2:D2)>5501;SUM(A2:D2)<=6000);SUM(A2:D2)*3.5%;IF(AND(SUM(A2:D2)>6001;SUM(A2:D2)<=6500);SUM(A2:D2)*4%;IF(AND(SUM(A2:D2)>6501;SUM(A2:D2)<=7000);SUM(A2:D2)*4.5%;IF(SUM(A2:D2)>7000;SUM(A2:D2)*5%))))))))))
    How can I change the formula to UDF so as to easily use it.?
    I have attached the expected results in this example
    Thanks advanced for help
    Attached Files Attached Files

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,899
    Location
    Option Explicit
    
    
    Function StampDutyTax(r As Range) As Double
        Dim Amt As Double
        
        Amt = Application.WorksheetFunction.Sum(r)
        
        Select Case Amt
            Case Is <= 3000
                StampDutyTax = 0#
            Case Is <= 3500
                StampDutyTax = 0.01 * Amt
            Case Is <= 4000
                StampDutyTax = 0.015 * Amt
            Case Is <= 4500
                StampDutyTax = 0.02 * Amt
            Case Is <= 5000
                StampDutyTax = 0.025 * Amt
            Case Is <= 5500
                StampDutyTax = 0.03 * Amt
            Case Is <= 6000
                StampDutyTax = 0.035 * Amt
            Case Is <= 6500
                StampDutyTax = 0.04 * Amt
            Case Is <= 7000
                StampDutyTax = 0.045 * Amt
            Case Else
                StampDutyTax = 0.05 * Amt
        End Select
        
    End Function
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    Version of Excel?
    Try formula:
    =XLOOKUP(SUM(A2:D2),{3000;3500;4000;4500;5000;5500;6000;6500;7000;1E+99},{0;0.01;0.015;0.02;0.025;0.03;0.035;0.04;0.045;0.05},"z",1)*SUM(A2:D2)
    which caters for values such as 3001,3501 etc.
    The formula could be shortened more, but exactly how depends on your version of Excel.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    Thank you very much for all of you
    How Can The formula could be shortened more? I'm using excel 2010
    Last edited by joky; 11-16-2023 at 03:28 PM.

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,512
    Location
    Joky, you initially asked for a UDF which Paul kindly provided you with. Now you are asking for a shortened formula. Which is it?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    Quote Originally Posted by joky View Post
    How Can The formula could be shortened more using Excel 2010?
    Could you show me the actual rules for stamp duty rates, rather than a formula which has interpreted them (I feel the interpretation isn't quite right)?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  7. #7
    Quote Originally Posted by p45cal View Post
    The formula could be shortened more, but exactly how depends on your version of Excel.
    I like to have multiple solutions for any problem Anyway Thanks for both of these solutions, both of which work wonderfully.
    Last edited by joky; 11-16-2023 at 03:36 PM.

Posting Permissions

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