Hello, looking for help with this formula. Need to calculate a future date based on the [End Date]
Conditions:
(1) Only display a future date if [Ord Amt] is true;
(2) Future date to be one month earlier then month of [End Date] unless;
(3) [End Date] month = January, then Future date is to be December and one year earlier than [End Date]
(4) All future dates are to calculate to the 2nd Tuesday of the Future date MONTH/YEAR
The formula I have works on all dates other than when the Future date is December. Those Future dates, the DAY always displays as “1” and is not calculating to the 2nd Tuesday of that December/YEAR. I've looked at this too long to see the error. Many thanks in advance.
=IF([Ord Amt]@row = true, IF(MONTH([End Date]@row) = 1, DATE(YEAR([End Date]@row) - 1, 12, 1) + IF(WEEKDAY(DATE(YEAR([End Date]@row) - 1, 12, 1)) = 3, IF(DAY(DATE(YEAR([End Date]@row) - 1, 12, 1)) = 1, 0, 7), 0), DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1) + IF(WEEKDAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1)) <= 3, IF(WEEKDAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1)) = 3, 7, 10 - WEEKDAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1))), 17 - WEEKDAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1))) + IF(WEEKDAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1)) = 3, IF(DAY(DATE(YEAR([End Date]@row), MONTH([End Date]@row) - 1, 1)) = 1, 0, 7), 0)), "")