Forum Discussion
EXCEL FORMULAS
- May 02, 2024
Let's say you have a range named Holidays that lists public holidays.
And let's say you want to compare Net Asset Value (column C) with the previous year.
For row 2, the previous year's value is
INDEX($C$2:$C$5000, XMATCH(1, ($B$2:$B$5000=$B2)*($L$2:$L$5000=WORKDAY(EDATE($L2, -12)+1, -1, Holidays))))
So the increase/decrease is
=C2/INDEX($C$2:$C$5000, XMATCH(1, ($B$2:$B$5000=$B2)*($L$2:$L$5000=WORKDAY(EDATE($L2, -12)+1, -1, Holidays))))-1
HansVogelaar, Here's my data. The missing date were either public holidays or weekends
Let's say you have a range named Holidays that lists public holidays.
And let's say you want to compare Net Asset Value (column C) with the previous year.
For row 2, the previous year's value is
INDEX($C$2:$C$5000, XMATCH(1, ($B$2:$B$5000=$B2)*($L$2:$L$5000=WORKDAY(EDATE($L2, -12)+1, -1, Holidays))))
So the increase/decrease is
=C2/INDEX($C$2:$C$5000, XMATCH(1, ($B$2:$B$5000=$B2)*($L$2:$L$5000=WORKDAY(EDATE($L2, -12)+1, -1, Holidays))))-1
- Edward_NdambalaMay 05, 2024Copper ContributorSo do you advice that I have a separate sheet which includes public holidays and weekends?
Afterwards, I use the formula you’ve mentioned?
Could you show your ideal data structure with the calculations you’ve made?- HansVogelaarMay 05, 2024MVP
You don't have to list weekend days - the WORKDAY formula will take care of that. If your weekend days are not Saturday/Sunday, you can use WORKDAY.INTL.
The range that lists public holidays can be on the same sheet as the data or on another sheet, whichever is more convenient to you. After entering the holidays, select the range, then click in the name/address box on the left hand side of the formula bar, type Holidays and press Enter.
The formula that I posted can be used in a cell in row 2, then filled down.
- Edward_NdambalaJun 24, 2024Copper Contributor
HansVogelaarThank you for the solution you gave me. It works for a differences in days but i've seen that my data has up to 3 days of no data. I've tried modifying the formula but i'm stuck. I was asking if you can assist in modifying the formula to include up to 3 days instead of 1.
I have attached what happens to my data with 1 day and the formulas i've used.
To get NAV: =INDEX([Net Asset Value], XMATCH(1, ([Scheme Name]=[@[Scheme Name]])*([Date]=WORKDAY(EDATE($L2, -12)+1, -1, Holidays))))
To get date of the NAV: =INDEX(Raw_Data[Date], XMATCH(WORKDAY(EDATE(Current_Date, -12)+1, -1, Holidays),Raw_Data[Date]))