IF Function
Below is a start to your results. I don't know enough information about the
current and previous month to finish the macro. How do you determine present
and previous month when there is only one date?
Sub GetResults()
RowCount = 1
Do While Range("A" & RowCount) < ""
Aging = Range("A" & RowCount)
Frequency = Range("B" & RowCount)
AgeofPymt = Range("C" & RowCount)
MyDate = Range("D" & RowCount)
Select Case Aging
Case Is < 60:
Results = "B/P"
Case Is <= 90:
Select Case Frequency
Case "Quarterly", "Annual", "Semi Annual":
Results = "B/P"
Case "Monthly":
Select Case AgeofPymt
Case Is < 61:
End Select
End Select
End Select
Range("E" & RowCount) = Results
RowCount = RowCount + 1
Loop
End Sub
"Ranjit kurian" wrote:
I have four columns, i need a macro to fill my fifth column using IF conditions
The Fist column contains Aging details like 1-30,31-60,61-90,91-180,181-360
and 360, this is always fixed.
The Second column contains Frequency details like Monthly,Quarterly, Semi
Annual, Annual this is always fixed.
The Third column contains Ages of Pymt details, here we have a numbers
begins from 1 till no end, but we have three categories here like =61 or =
blank etc....
The fourth column contains Month details in this formate MMM/YY(Jan/09) (the
months and years are not fixed it can be any month any year)
The Fifth is my result column (Category), i need a macro as explained below
For Aging 1-30 and 31-60 there are no conditions, for these two aging the
fifth cloumn
(Category) result should be B/P
For Aging:61-90, Frequency:Quarterly,Annual,Semi Annual, for these the fifth
cloumn
(Category) result should be B/P
IF the Frequency: Monthly, Age of Pymt : <61,Month: Current month/Previous
month (Jan/09, Dec/08) then the fifth cloumn (Category) result should be B/P
IF the Frequency: Monthly, Age of Pymt : <61,Month: Prior to Current
month/Previous month (Nov/08, Feb/08) then the fifth cloumn (Category)
result should be NB/P
IF the Frequency: Monthly, Age of Pymt : =61 or =blank ,Month: Current
month/Previous month (Jan/09, Dec/08) then the fifth cloumn (Category)
result should be B/NP
IF the Frequency: Monthly, Age of Pymt : =61 or =blank ,Month: Prior to
Current month/Previous month (Nov/08, Feb/08) then the fifth cloumn
(Category) result should be NB/NP
IF the Frequency: Quarterly, Age of Pymt : <121,Month: Current
month/Previous month (Jan/09, Dec/08,Nov/08 take three months) then the fifth
cloumn (Category) result should be B/P
IF the Frequency: Quarterly, Age of Pymt : <121,Month: Prior to Current
month/Previous month (Oct/08, sept/08, Aug/08 take three months) then the
fifth cloumn (Category) result should be NB/P
IF the Frequency: Quarterly, Age of Pymt : =121 or =blank,Month: Current
month/Previous month (Jan/09, Dec/08,Nov/08 take three months) then the fifth
cloumn (Category) result should be B/NP
IF the Frequency: Quarterly, Age of Pymt : =121 or =blank,Month: Prior
Current month/Previous month (Oct/08, sept/08, Aug/08 take three months) then
the fifth cloumn (Category) result should be NB/NP
IF the Frequency: Annual, Age of Pymt : <181,Month: Current month/Previous
month (from current month calculate 12 months Jan/09 till Feb/08) then the
fifth cloumn (Category) result should be B/P
IF the Frequency: Annual, Age of Pymt : <181,Month: Prior to Current
month/Previous month (Jan/08, Dec/07) then the fifth cloumn (Category) result
should be NB/P
IF the Frequency: Annual, Age of Pymt : =181 or =blank,Month: Current
month/Previous month (from current month calculate 12 months Jan/09 till
Feb/08) result should be B/NP
IF the Frequency: Annual, Age of Pymt : =181 or =blank,Month: Prior Current
month/Previous month (Jan/08, Dec/07) then the fifth cloumn (Category) result
should be NB/NP
|