Google-sheets – Unclear behaviour in Google Sheets custom number format

google sheets

When I use Google Sheets, I can format numbers Format -> Number -> More Formats -> Custom number format .... There are specific placeholders described in the help.

What's not mentioned, however, is the following behaviour:

When I set the custom format to d, 18 appears. If I write ed, another number appears. Using quotation marks leads to the correct value.

Why do some letters represent numbers? What's the logic behind it? I had the clue that it could be a date format, but d-m-y does not lead to the correct date.

Best Answer

Actually, you nailed it. those letters do represent date values however date needs to be in the specific overall format:

  • d needs to be in a pair like dd or ddd
  • same goes for m > mm or mmm (single m stands for minutes)
  • and the year is usually yyyy

eg valid format would be "MM/DD/YYYY" or dd.mm.yyyy etc.

check this for more knowledge: https://developers.google.com/sheets/api/guides/formats