Nested expressions, less columns

I just had a look at your formulas: the if conditions hidden in the min/max operators are pretty gorgeous. My hunch had been to start on the last day of the month and then subtract 1 or 2 to account for Saturday and Sunday using ITE columns, but I had no idea how to identify week days for the ITE conditions. Anyway the min/max operators are just so much more elegant.

The only thing that bothers me – and I’ll use this to put myself to sleep, it’ll work like a charm – is the lack of symmetry between +min,6 and -max,2. :sleeping: (For our practical purposes it works fine of course.)

Thanks for this!

4 Likes

I think to do this, it would require a math column to calculate the last day of the month. A math column to calculate the weekday of that date, an IF column that returns 1 if the weekday is 7 or 2 if the weekday is 1, else 0, and finally a final math column to subtract that IF result from the last day of the month. Easier to understand, but 4 columns instead of 1.

Totally agree on this. Trying to get a 1 out of 7 and a 2 out of 1 was tricky. Maybe there is a more elegant way to do it mathematically, but that’s beyond my abilities.

2 Likes