+ Reply to Thread
Results 1 to 4 of 4

Thread: Help with applying paypal fee to a row

  1. #1
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Help with applying paypal fee to a row

    Hello All,

    We normally charge our customers full prices for our online services. For example £50

    I used to enter the value into my spreadsheet and it would calculate the VAT and total (Inc. VAT)

    So example £50 + (20% VAT) = £60 nice and simple!

    However we have now moved away from credit card payments, to payments through paypal.

    Paypal charges a fee of 3.4% on the whole value.

    E.g £60 - 3.4% = £57.96

    They then also charge a further 0.2p for the transaction.

    = £57.76

    I would like a button that converts my entries into paypal adjusted values.
    I have created a mock up file. I will need to be able to make changes to the paypal % and additional fee, as the fees scale depending on how much money we earn via paypal. So these values need to be left on the spreadsheet so I can adjust as I please.

    I just want to select a total. hit my button and it will adjust all values on that row taking into account the paypal fee.

    Please take a look at the file as it may make more sense.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: Help with applying paypal fee to a row

    Hello ebbo,

    The following macro has been added to your button in the attached workbook.
    Sub ApplyPayPalFees()
    
      Dim Cell As Range
      Dim Price As Currency
      Dim Rng As Range
      Dim RngEnd As Range
      Dim ServiceFee As Double
      Dim TransactionFee As Double
      Dim VAT As Currency
      Dim Wks As Worksheet
      
        Set Wks = ActiveSheet
        
        Set Rng = Wks.Range("A2")
        Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
        If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Wks.Range(Rng, RngEnd)
        
          ServiceFee = (1 - Wks.Range("I2"))
          TransactionFee = Wks.Range("J2")
          
          For Each Cell In Rng
            Price = Cell * ServiceFee
            VAT = Cell.Offset(0, 1) * ServiceFee
            Cell = Price
            Cell.Offset(0, 1) = VAT
            Cell.Offset(0, 2) = (Price + VAT) - TransactionFee
          Next Cell
          
    End Sub
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Help with applying paypal fee to a row

    thanks for this, appreciate it really. Sorry it took me a while to get back. Thats work ok. The only adjustment I require is that the paypal adjustment should only effect the currently selected row.

    The reason is we still do cheque payments which need to be entered into the same spreadsheet and we dont want those values adjusted.

    I did try to record a macro and then just select a row, but it keeps adjusting everything.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: Help with applying paypal fee to a row

    Hello ebbo,

    I made the changes to the macro. This will let you apply the PayPal and service charges to the selected cells in columns "A:C". If you don't select all three columns, you will be told to do so. You can also select more than a single row at time.
    'Thread:  http://www.excelforum.com/excel-programming/780300-help-with-applying-paypal-fee-to-a-row.html#post2553889
    'Poster:  Ebbo
    'Written: June 16, 2011
    'Updated: June 30, 2011 - Added error handling and manual selection of data.
    'Author:  Leith Ross
    
    Sub ApplyPayPalFees()
    
      Dim Price As Currency
      Dim Row As Range
      Dim Rng As Range
      Dim ServiceFee As Double
      Dim TransactionFee As Double
      Dim VAT As Currency
      Dim Wks As Worksheet
      
        Set Wks = ActiveSheet
        
        Set Rng = Wks.Range("A1").CurrentRegion
        Set Rng = Intersect(Rng, Rng.Offset(1, 0))
        
        If Intersect(Selection, Rng) Is Nothing Then Exit Sub
        
        If Selection.Cells.Count < Rng.Rows(1).Cells.Count Then
           MsgBox "Please select all cells in the row.", vbExclamation
           Exit Sub
        End If
        
          ServiceFee = (1 - Wks.Range("I2"))
          TransactionFee = Wks.Range("J2")
          
          For Each Row In Selection.Rows
            Price = Row.Cells(1, 1) * ServiceFee
            VAT = Row.Cells(1, 2) * ServiceFee
            Row.Cells(1, 1) = Price
            Row.Cells(1, 2) = VAT
            Row.Cells(1, 3) = (Price + VAT) - TransactionFee
          Next Row
          
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0