Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

How to convert Day name to weekday number?

Solved
Jump to Solution
2264 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Mayank_Agarwal
6 - Interface Innovator
6 - Interface Innovator

I have a column named Day name which is a single select field containing names of day - Monday, Tuesday, etc.
How can I create another column which gives the weekday number of this? I know I need to use Weekday() function, but how can I set it up such that it converts the string to work with Weekday() function?

Thanks.

1 Solution

Accepted Solutions
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hi Mayank, I don’t think the weekday() function works for that as it expects a date

This formula should serve your needs, and you can modify the numbers as needed depending on when your week starts:

SWITCH(
  Name,
  'Sunday', 0,
  'Monday', 1,
  'Tuesday', 2,
  'Wednesday', 3,
  'Thursday', 4,
  'Friday', 5,
  'Saturday', 6
)

Screenshot 2022-05-31 at 6.47.46 PM

See Solution in Thread

2 Replies 2
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hi Mayank, I don’t think the weekday() function works for that as it expects a date

This formula should serve your needs, and you can modify the numbers as needed depending on when your week starts:

SWITCH(
  Name,
  'Sunday', 0,
  'Monday', 1,
  'Tuesday', 2,
  'Wednesday', 3,
  'Thursday', 4,
  'Friday', 5,
  'Saturday', 6
)

Screenshot 2022-05-31 at 6.47.46 PM

Thank you so much Adam!
Particularly thanks for taking the pain to write the entire function for me when you could’ve simply guided me :grinning_face_with_big_eyes:

Sincerely appreciate your effort. I will start using this.