Skip to main content

IF Created time is in week no ... then

  • October 2, 2020
  • 4 replies
  • 47 views

Forum|alt.badge.img+2

Hi everybody

I’m looking for a formula that goes like this:

IF: Created time is in week no. 40 then “A”
IF: Created time is in week no. 41 then “B”
IF: Created time is in week no. 42 then “C”

I tried to do it myself… Nearly had it (I think) But I got errors.

Can you guys help me?

4 replies

Kamille_Parks11
Forum|alt.badge.img+27

Since you’re comparing the same value multiple times, I would recommend using a SWITCH() function. Your formula will look something like this:

SWITCH(
   WEEKNUM(CREATED_TIME()), 
   40, 'A', 
   41, 'B', 
   42, 'C'
)

Forum|alt.badge.img+2
  • Author
  • Inspiring
  • October 5, 2020

Since you’re comparing the same value multiple times, I would recommend using a SWITCH() function. Your formula will look something like this:

SWITCH(
   WEEKNUM(CREATED_TIME()), 
   40, 'A', 
   41, 'B', 
   42, 'C'
)

Hi Kamille,

Thank you! That one helped me a lot. I try to do it with IF statements at first. I didn’t even know the SWITCH() function excisted. It kinda works now but I have a second problem… Is there a way to start counting the weeknumbers from sunday till sunday instead of monday till monday?

Let me know if you can help.

Thanks.


Kamille_Parks11
Forum|alt.badge.img+27

Hi Kamille,

Thank you! That one helped me a lot. I try to do it with IF statements at first. I didn’t even know the SWITCH() function excisted. It kinda works now but I have a second problem… Is there a way to start counting the weeknumbers from sunday till sunday instead of monday till monday?

Let me know if you can help.

Thanks.


Yes. You pass either “Sunday” or “Monday” as the second argument in the WEEKNUM() function.


Forum|alt.badge.img+2
  • Author
  • Inspiring
  • October 5, 2020

Yes. You pass either “Sunday” or “Monday” as the second argument in the WEEKNUM() function.


Thanks for the fast reply.

I think I already did it myself by adding: DATEADD({Created_time}, -1, ‘days’)

I really wonder what you thought would also work tho :slightly_smiling_face:

Gr.