# Nested expressions, less columns

**URL:** <https://community.glideapps.com/t/nested-expressions-less-columns/40662>\
**Category:** Ask for Help\
**Created:** [April 12, 2022, 4:36pm UTC](https://community.glideapps.com/t/nested-expressions-less-columns/40662 "2022-04-12T16:36:17Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [April 13, 2022, 10:23pm UTC](https://community.glideapps.com/t/nested-expressions-less-columns/40662/22 "2022-04-13T22:23:08Z")

</div>

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. 😴 (For our practical purposes it works fine of course.)

Thanks for this!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 14, 2022, 2:46am UTC](https://community.glideapps.com/t/nested-expressions-less-columns/40662/23 "2022-04-14T02:46:18Z")

</div>

> [@nathanaelb](#):
>
> I had no idea how to identify week days for the ITE conditions

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.

> [@nathanaelb](#):
>
> is the lack of symmetry

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.

[Previous page](https://community.glideapps.com/t/nested-expressions-less-columns/40662.md?page=1)
