devMethodes
devMethodes

Reputation: 199

Add zero in number in Google Sheets formula

I am looking for a formula in Google Sheets to find the number of the week of a date. The desired result would be a concatenation of S + the number of the week (with a space between the two). If the number of the week is less than 10, I would like an extra 0 in this data.

Here are the different results desired according to the different cases:

01/01/2023 → S 52
02/01/2023 → S 01
27/08/2023 → S 09

After many attempts, I still cannot incorporate the 0 when the week number is less than 10. Could you please help me?

Here is my formula (assuming a date is in A1):

="S "&(SI(NO.SEMAINE(A1)-1<10);"0"&NO.SEMAINE(A1)-1;NO.SEMAINE(A1)-1)

Upvotes: 0

Views: 96

Answers (2)

rockinfreakshow
rockinfreakshow

Reputation: 29967

Can you try:

="S "&TEXT(WEEKNUM(A1;21);"00")

enter image description here

Upvotes: 3

Harun24hr
Harun24hr

Reputation: 36860

Use TEXT() function. Try-

="S + " & TEXT(WEEKNUM(A1);"00")

Upvotes: 0

Related Questions