Another day, another formula question.
A colleague and I have struggled to create a formula that will calculate per diem costs (mealsGrossTotal) depending on the travel departure date (DepartureDateReformat) and the number of days of travel (TotalDays). We finally got this to work:
=IF(DepartureDateReformat>DATE(2024,9,30),IF(TotalDays=1,SUB(mealsGrossTotal,17.00),IF(TotalDays=2,SUB(mealsGrossTotal,34.00),IF(TotalDays>2,SUB(mealsGrossTotal,34.00),0))),mealsGrossTotal)
We then realized that for two of the elements (TotalDays=1 and TotalDays=2) we needed to use a percentage rather than a flat rate. We tried to follow the pattern of the working formula but just can't get it right:
=IF(DepartureDateReformat>DATE(2024,9,30),IF(TotalDays=1,SUB(PRODUCT(mealsGrossTotal,0.75),IF(TotalDays=2,SUB(PRODUCT(mealsGrossTotal,0.75),IF(DepartureDateReformat>DATE(2024,9,30),IF(TotalDays>2,SUB(mealsGrossTotal,34.00),0)))))),mealsGrossTotal)
Each of the elements (TotalDays=1, TotalDays=2, TotalDays>2) work individually and it appears that we have the right number of parentheses when combined. Would appreciate any help as we were given a short deadline for this with the approach of the new fiscal year.