Hi I would like to tweak some code that works well to add one additional IF statement. The code I am using is below. I would like to build in the following formula:
IF(appliedCommission >= 0.35, appliedCommission, 0.35) + (prEntry * Quantity * transactFee)
Any assistance would be most appreciated!
IF(appliedCommission >= 0.35, appliedCommission, 0.35) + (prEntry * Quantity * transactFee)
Any assistance would be most appreciated!
VBA Code:
'Vlook to calculate the commission payable'
Private Sub calculateCommissionPayable(actvSheet As Worksheet)
Dim rw As Range
Dim col As Range
Dim commPS As Double
Dim transactFee As Double
Dim quantity As Integer 'Current Quantity
Dim prEntry As Integer 'Share price
Set instructSheet = ActiveWorkbook.Sheets("DAS_DATA")
Set instructSheet = ActiveWorkbook.Sheets("INSTRUCTIONS")
commPS = instructSheet.Range("E47")
transactFee = instructSheet.Range("E49")
For Each rw In actvSheet.UsedRange.Rows 'Looping on each row of Sheet1'
If rw.row <> 1 Then 'Skip first header row'
Dim appliedCommission As Double 'Calculated commission'
quantity = convertToInt(Cells(rw.row, 5).Value)
appliedCommission = quantity * commPS 'references the named range "COMM_PER_SHARE" on "INSTRUCTIONS" sheet'
actvSheet.Cells(rw.row, 14).Value = appliedCommission 'applies commission per ticket
End If 'Check if not First Row'
Next rw
Exit Sub
End Sub