Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'm trying to create a function that allows me to put in two different months (either as text or numbers it doesn't matter) and then tell me the date that a payment is due.
Basically, provisional tax is due three times a year and depending on when a person's balance date is the three dates change.
I have a very basic knowledge of VBA and am a little rusty. I can't seem to make the function work.
Here is what I have so far:
Function ProvTax(BalanceDate, Month)
If BalanceDate = "October" Then
If Month = "December" Or "January" Or "February" Or "March" Then
ProvTax = "28 March"
ElseIf Month = "April" Or "May" Or "June" Or "July" Then
ProvTax = "28 July"
ElseIf Month = "August" Or "September" Or "October" Or "November" Then
ProvTax = "28 November"
End If
ElseIf BalanceDate = "November" Then
If Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "7 May"
ElseIf Month = "June" Or "July" Or "August" Then
ProvTax = "28 August"
ElseIf Month = "September" Or "October" Or "November" Or "December" Or "January" Then
ProvTax = "15 January"
End If
ElseIf BalanceDate = "December" Then
If Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "28 May"
ElseIf Month = "June" Or "July" Or "August" Or "September" Then
ProvTax = "28 September"
ElseIf Month = "October" Or "November" Or "December" Or "January" Then
ProvTax = "28 January"
End If
ElseIf BalanceDate = "January" Then
If Month = "March" Or "April" Or "May" Or "June" Then
ProvTax = "28 June"
ElseIf Month = "July" Or "August" Or "September" Or "October" Then
ProvTax = "28 October"
ElseIf Month = "November" Or "December" Or "January" Or "February" Then
ProvTax = "28 February"
End If
ElseIf BalanceDate = "February" Then
If Month = "April" Or "May" Or "June" Or "July" Then
ProvTax = "28 July"
ElseIf Month = "August" Or "September" Or "October" Or "November" Then
ProvTax = "28 November"
ElseIf Month = "December" Or "January" Or "February" Or "March" Then
ProvTax = "28 March"
End If
ElseIf BalanceDate = "March" Then
If Month = "June" Or "July" Or "August" Then
ProvTax = "28 August"
ElseIf Month = "September" Or "October" Or "November" Or "December" Or "January" Then
ProvTax = "15 January"
ElseIf Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "7 May"
End If
ElseIf BalanceDate = "April" Then
If Month = "June" Or "July" Or "August" Or "September" Then
ProvTax = "28 September"
ElseIf Month = "October" Or "November" Or "December" Or "January" Then
ProvTax = "28 January"
ElseIf Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "28 May"
End If
ElseIf BalanceDate = "May" Then
If Month = "July" Or "August" Or "September" Or "October" Then
ProvTax = "28 October"
ElseIf Month = "November" Or "December" Or "January" Or "February" Then
ProvTax = "28 February"
ElseIf Month = "March" Or "April" Or "May" Or "June" Then
ProvTax = "28 June"
End If
ElseIf BalanceDate = "June" Then
If Month = "August" Or "September" Or "October" Or "November" Then
ProvTax = "28 November"
ElseIf Month = "December" Or "January" Or "February" Or "March" Then
ProvTax = "28 March"
ElseIf Month = "April" Or "May" Or "June" Or "July" Then
ProvTax = "28 July"
End IfElseIf BalanceDate = "July" Then
If Month = "September" Or "October" Or "November" Or "December" Or "January" Then
ProvTax = "15 January"
ElseIf Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "7 May"
ElseIf Month = "June" Or "July" Or "August" Then
ProvTax = "28 August"
End If
ElseIf BalanceDate = "August" Then
If Month = "October" Or "November" Or "December" Or "January" Then
ProvTax = "28 January"
ElseIf Month = "February" Or "March" Or "April" Or "May" Then
ProvTax = "28 May"
ElseIf Month = "June" Or "July" Or "August" Or "September" Then
ProvTax = "28 September"
End IfElseIf BalanceDate = "September" Then
If Month = "November" Or "December" Or "January" Or "February" Then
ProvTax = "28 January"
ElseIf Month = "March" Or "April" Or "May" Or "June" Then
ProvTax = "28 May"
ElseIf Month = "July" Or "August" Or "September" Or "October" Then
ProvTax = "28 September"
End If
End IfEnd Function
It is probably hopelessly wrong, but can anyone tell me if I am on the right track?
I was thinking about changing all the text to numbers, ie just make the month names the number they relate to (Jan =1)
Thanks in advance.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |