hrdpgajjar
Registered User.
- Local time
- Today, 17:37
- Joined
- Sep 24, 2019
- Messages
- 51
Hi there,
I've create two functions to get data of current financial year (1st April to 31st March) as under,
1. Financial year start function,
2. Financial Year End Function,
Both the functions works correctly. But now I need to get data from last financial year to compare with current Financial year. I've tried to modify the start and end financial year functions but it not works. it breaks my current year data. So kindly help me how can i get last financial year data.
Thanks
I've create two functions to get data of current financial year (1st April to 31st March) as under,
1. Financial year start function,
Code:
Public Function fnFinancialYearStart(Optional ByVal start_date As Date = 1) As Date
Dim x_date As Date
If start_date = 1 Then
start_date = Date
End If
x_date = DateSerial(Year(start_date), 4, 1)
If start_date < x_date Then
x_date = DateAdd("yyyy", -1, x_date)
End If
fnFinancialYearStart = x_date
End Function
2. Financial Year End Function,
Code:
Public Function fnFinancialYearEnd(Optional Byval start_date As Date = 1) As Date
start_date = fnFinancialYearStart(start_date)
fnFinancialYearEnd = DateAdd("yyyy", 1, start_date) - 1
End Function
Both the functions works correctly. But now I need to get data from last financial year to compare with current Financial year. I've tried to modify the start and end financial year functions but it not works. it breaks my current year data. So kindly help me how can i get last financial year data.
Thanks