Workday results for next year result in blue warning

Hello,


I use a WORKDAY formula that gives me the results I’m looking for, but when the result is in the following year, a blue warning triangle appears. For some reason, I’m unable to see what the warning is when I tap it while using my iPad. Using a MacBook reveals the warning: DATE month argument should be between 1 and 12.


This part of my table is for when a bank statement is generated, and when the payment is due. The due date is the 14th of the next month, unless the 14th is a weekend or holiday. In those cases, the due date is the last workday before the 14th. The formula I use is:

WORKDAY(DATE(YEAR(B14),MONTH(B14)+1,14)+1,−1,Holidays::Date)

It works fine until December 3rd of every year. The result for the following January is correct, but I don’t know how to correctly write the formula to avoid the error.


Please help me correct my formula. I’m trying to avoid changing it every 12 rows, so it’s just one formula that I can use for every row. Thanks so much for your help.

iPad Pro (5th generation)

Posted on Apr 25, 2025 12:11 PM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Apr 25, 2025 1:37 PM

Thinking about it, you may need to add the EDATE() to the YEAR() function, too.


As written, the YEAR() is returning the year from column B (2025), whereas you want the year from that date one month later. Adding EDATE() to that year field will return the whatever year the next month falls in.


If you're running Numbers 14.4, with its support for the LET() function, you could simplify this a little:



In this example, LET creates a new variable called next_month which is calculated by EDATE(A2,1) - that is, one month later than the date in A2.

This variable is then used in a DATE() calculation to determine the new variable due_date. This, in turn, is passed to WORKDAY() to find the next working day (I omitted your non-working days, but figure you can add that back in).


LET() makes it easier to work with complex nested functions.

7 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

Apr 25, 2025 1:37 PM in response to jess_brat

Thinking about it, you may need to add the EDATE() to the YEAR() function, too.


As written, the YEAR() is returning the year from column B (2025), whereas you want the year from that date one month later. Adding EDATE() to that year field will return the whatever year the next month falls in.


If you're running Numbers 14.4, with its support for the LET() function, you could simplify this a little:



In this example, LET creates a new variable called next_month which is calculated by EDATE(A2,1) - that is, one month later than the date in A2.

This variable is then used in a DATE() calculation to determine the new variable due_date. This, in turn, is passed to WORKDAY() to find the next working day (I omitted your non-working days, but figure you can add that back in).


LET() makes it easier to work with complex nested functions.

Reply

Apr 26, 2025 11:39 AM in response to SGIII

Thanks, @SGIII.


I think LET() has three main use cases where I find it useful.


First is cases where you might previously have used a dummy/hidden column to calculate an intermediate value. In this case, I could have used a hidden column to calculate the 'next month' value, but using LET and storing it in a variable within the formula is neater.


The second is where the formula is repeating some function - in this case, the formula was calculating the YEAR() and the MONTH() of an offset date. The typical way of doing this would be:


=DATE(YEAR(EODATE(original_date,1)), MONTH(EODATE(original_date,1)),14)


so here the EODATE() function is called twice, once for the year, and once for the month. It's more efficient to call EODATE() once and store the result. Any time a sub-function is repeated within a formula, it's a good candidate for LET().


The third case is nested functions where the (IMHO abysmal) spreadsheet syntax really makes it hard to read - I'm thinking especially of things like AND(OR()) conditions that don't follow a natural-language flow.

In these cases, it's often easier to read when the nested functions are broken out into variables.


Now, instead of:


=IF(AND(OR(B2>$B$1,C2>$C$1,AND(E2<$E$1,F2>$F$1),TRUE,FALSE)


You can say something like:

=LET(option_1,OR(B2>$B$1,C2>$C$1),
     option_2,AND(E2<$E$1,F2>$F$1),
     IF(AND(option_1, option_2),TRUE,FALSE)


Here the various IF(AND()) components are broken out into their own statements, and the actual TRUE/FALSE logic is much easier to read.


Reply

Apr 25, 2025 12:27 PM in response to jess_brat

The error makes sense when you think about it...


Your formula is trying to create a new date by adding 1 to the current month.


When the Month is December (12), adding 1 results in month 13... hence the error..


The blue triangle is trying to tell you this day may be wrong because of this wrap (in fact, Numbers gets it right in this instance, but it still warns you)


In either case, the solution is simple - instead of simply adding 1 to the month, use EDATE() to calculate the next month.


Replace


MONTH(B11)+1


with:


MONTH(EDATE(B11,1))


This adds '1 month' to the date in B11, which will handle the wrap-around at the end of the year.

Reply

Apr 25, 2025 1:15 PM in response to Camelot

Thanks so much for helping me out with this! I really appreciate it. I can’t seem to make it work—replacing MONTH(B11)+1 with MONTH(EDATE(B11,1)) only adds to the month, not to the year. So, 12/03/25 results in 01/14/25, instead of 01/14/26.


I get what you’re saying about how adding 1 to month 12 equals month 13. 13 triggers the “between 1 and 12” error. Do you think there would be a way to just clear the warning? Or should I keep trying to change the formula? The only other thing I can come up with is add 1 to the year, subtract 11 from the month… but then I’m in the same position where I would have to have a different formula for every December. I’d love to know if you can help me find another function that could work in my formula. Thanks again!

Reply

Apr 25, 2025 1:46 PM in response to Camelot

You did it! Your new formula works perfectly. I love that you taught me about LET, I’m going to use that one all the time now that I know about it. I’d tried doing EDATE for the year as well, but I just couldn’t get it to work for every row. Creating a new variable was exactly what I needed. Thanks again!

Reply

Workday results for next year result in blue warning

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.