Hello,
I am having a problem with a conditional statement (IF c THEN t ELSE f ENDIF), below is my formula. I am having a hard time with the last step. it gives me the "Invalid type in operator >=" error.
I am trying to change the Week numbers to months, so IF Week No is less then 6, change it to Jan. If Week number is between 6 and 9, change to Feb, and so on and so forth. But the last ELSEIF is giving me an error and I'm not sure how to fix that.
IF [Week No.] < 6 THEN "Jan"
ELSEIF [Week No.] >= 6 AND [Week No.] < 9 THEN "Feb"
ELSEIF [Week No.] >= 10 AND [Week No.] < 13 THEN "Mar"
ELSEIF [Week No.] >= 14 AND [Week No.] < 17 THEN "Apr"
ELSEIF [Week No.] >= 18 AND [Week No.] < 22 THEN "May"
ELSEIF [Week No.] >= 23 AND [Week No.] < 26 THEN "Jun"
ELSEIF [Week No.] >= 27 AND [Week No.] < 31 THEN "Jul"
ELSEIF [Week No.] >= 32 AND [Week No.] < 35 THEN "Aug"
ELSEIF [Week No.] >= 36 AND [Week No.] < 39 THEN "Sep"
ELSEIF [Week No.] >= 40 AND [Week No.] < 44 THEN "Oct"
ELSEIF [Week No.] >= 45 AND [Week No.] < 48 THEN "Nov"
ELSEIF [Week No.] >= 49 THEN "Dec"
ELSE ""
ENDIF
Solved! Go to Solution.
@msalas0308
just as @Luke_C mentioned, if the data type of the 'Week No.' field is numeric, then it works. but thlatter < should be <=.
And there is a not so brutal way, and more accurate, since the week number to Month Relation is not fixed for each year.
I knew it was something simple lol thank you @Luke_C
Yea, I figured it out from @Luke_C original response. Thank you for the help as well.
@msalas0308
Maybe I suggest you check the answer from me without the conditional statement?
it is more dynamic and accurate way, I believe.
@Qiu That worked better, thank you.
Is there a reason why you are using Less than operator (<) instead of Less than Equal (<=) operator? Just curious why you would want to mark the week numbers with those values with blank space?
Thank You,
B