# Grouping list items by week

**URL:** <https://community.glideapps.com/t/grouping-list-items-by-week/55617>\
**Category:** Ask for Help\
**Created:** [December 10, 2022, 5:45am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617 "2022-12-10T05:45:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mberns01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mberns01/32/51549_2.png) [@mberns01](https://community.glideapps.com/u/mberns01)\
**Post date:** [December 10, 2022, 5:45am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/1 "2022-12-10T05:45:40Z")

</div>

I have a list of items and would like to group them by week, based on a submitted date field.

Is there a formula I can use or display a week number for each? I would like each new week to start on Wednesday.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [December 10, 2022, 8:40am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/2 "2022-12-10T08:40:46Z")

</div>

use WEEKNUM formula

---

<div class="post-metadata">

**Author:** ![mberns01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mberns01/32/51549_2.png) [@mberns01](https://community.glideapps.com/u/mberns01)\
**Post date:** [December 10, 2022, 10:50pm UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/3 "2022-12-10T22:50:10Z")

</div>

thank you so much! however, the weeks are slightly off since im trying to start new on Wednesdays. here’s the formula i use to accomplish this in airtable. any idea how to rebuild this logic in Glide?

ROUNDUP((DATETIME\_FORMAT({Date},‘DDDD’)+3)/7,0)

In other words,

((Day of the year)+3)/7, rounded up

Where day of the year is a number from 1 to 365.

Thanks again. I really appreciate your help.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [December 10, 2022, 11:14pm UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/4 "2022-12-10T23:14:45Z")

</div>

use the math column, and count how many days pass from the begging of the year - 3 / 7… now the question is… you will be calculating pass years or only the current year?

---

<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:** [December 10, 2022, 11:15pm UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/5 "2022-12-10T23:15:17Z")

</div>

Try this in a math column and see if you get the results you are expecting.

```auto
CEILING((
(FLOOR(275 * MONTH(date) / 9)
- (FLOOR((MONTH(date) + 9) / 12)
* (1 + FLOOR((YEAR(date) - 4 * FLOOR(YEAR(date) / 4) + 2) / 3)))
+ DAY(date)
- 30)
+3)/7)

```

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [December 10, 2022, 11:33pm UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/6 "2022-12-10T23:33:13Z")

</div>

you should subtract 3, not add… Great formula @Jeff_Hager… but for the leap years, I would just create a 1/1/year date and subtract from DATE - 3 / 7

---

<div class="post-metadata">

**Author:** ![mberns01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mberns01/32/51549_2.png) [@mberns01](https://community.glideapps.com/u/mberns01)\
**Post date:** [December 11, 2022, 1:38am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/7 "2022-12-11T01:38:23Z")

</div>

> [@Jeff\_Hager](#):
>
> ```auto
> CEILING((
> (FLOOR(275 * MONTH(date) / 9)
> - (FLOOR((MONTH(date) + 9) / 12)
> * (1 + FLOOR((YEAR(date) - 4 * FLOOR(YEAR(date) / 4) + 2) / 3)))
> + DAY(date)
> - 30)
> +3)/7)
> 
> ```

it works! thanks so much!

---

<div class="post-metadata">

**Author:** ![mberns01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mberns01/32/51549_2.png) [@mberns01](https://community.glideapps.com/u/mberns01)\
**Post date:** [December 11, 2022, 1:39am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/8 "2022-12-11T01:39:41Z")

</div>

Is there a list of all formulas somewhere? CEILING, FLOOR, WEEKNUM, DAY…etc? where can i find the full list with explanations. thanks again!

---

<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:** [December 11, 2022, 2:46am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/9 "2022-12-11T02:46:58Z")

</div>

Most are listed in the docs. I think there are a few functions that aren’t listed (for example WEEKNUM is not listed), so it’s just trial and error or searching through the forum to see what’s possible and examples.

> **[Glide Docs • Math Column](https://www.glideapps.com/docs/reference/computed-columns/math-column)**
>
> Perform instant calculations using the data in your project.

---

<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:** [December 11, 2022, 9:16pm UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/10 "2022-12-11T21:16:30Z")

</div>

I had a little more time to think about this and I’m trying to come up with a better formula. I based my previous formula purely on the formula you were using in airtable and didn’t really test it thoroughly, but I think there are some flaws with it.

I’m trying to understand one thing. Let’s take 2023 for example. January 1st begins on a Sunday. Would the 1st, 2nd, and 3rd (Sunday, Monday and Tuesday) be grouped together as week 1 and the 4th would begin week 2, or should they be grouped with week 53 from the prior year (included Dec 28th through the 31st), and Wednesday the 4th would actually be week 1. I guess my question is, do your week groupings only entail a single year, or can a week flow between years?

---

<div class="post-metadata">

**Author:** ![mberns01](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mberns01/32/51549_2.png) [@mberns01](https://community.glideapps.com/u/mberns01)\
**Post date:** [December 13, 2022, 7:39am UTC](https://community.glideapps.com/t/grouping-list-items-by-week/55617/11 "2022-12-13T07:39:24Z")

</div>

Hey Jeff, thank you so much for continuing to help with this. The Week Groupings can flow between years. Ideally the 1st, 2nd and 3rd (Sun, Mon, Tues) would be grouped together as Week 1 and the 4th would begin week 2. But they could also be included in Week 53 from the prior year. It’s not important as long as long as each day is only included in one Week Grouping.
