New Date Formatting Trick Kind Of

April 29, 2010 by datapig Leave a reply »

So I’m teaching this Dashboarding class with Jon Peltier, when he mentions that if you format your dates with 5 m’s (“mmmmm”) you get the first letter of the month name.

What?! Do you know how long I’ve been typing (J, F, M, A, M, J, J, A, S, O, N, D)? It’s beyond me how I never found this nifty trick.

 

Here’s the deal:

If you go to the Format Cells Dialog box and Click on the Custom option, you can enter a custom syntax.

Entering mmmmm formats your dates so that they only show the first letter of the month name.

 

 

Here’s what happens to a date when applying m formatting.

So what happens if you decide to be an ass and enter 10 m’s? Excel defaults to showing the entire month name.

 

 

Being an Access guy, I decided to try this in Access. Here’s what happen in Access.

Not only does Access not give you the first letter of the month, but apparently, Access isn’t smart enough to stop formatting if the user gets spastic with the m’s.

 formatdate1

 

How about it? Am I the last one to know about the 5 m trick?

RELATED STUFF

  1. Mocking the ‘Merge & Center’ Icon
  2. Lazy Alternate Shading
  3. Padding Numbers with Zeros
  4. An Easier Way to Remove Formatting
  5. Getting Rid of Sticky Click
  6. Flipping a Range Upside Down
  7. Paste Special Skip Blanks
  8. Avoiding Data Cut-Off in Excel
  9. Why FIND when you can SEARCH
  10. Formula Auditing Art
Advertisement

20 Responses

  1. MT says:

    News to me! Wow, this is why I love your blog, always something new and useful and tricksie…thanks for keeping it up!

  2. m-b says:

    Great tip! Didn’t know about it either.

  3. PragmaticCynic says:

    Great tip. New to me. Wish we had the money to have been at you camp this week. Would love to see a blog post from you or Jon about it.

  4. I didn’t know that, either.

    So I guess it’s official: Peltier is the smartest man in the whole world.

  5. Michael Pennington says:

    I stumbled on it a few months ago in Allen Wyatt’s custom formatting e-book, but oddly his corresponding blog post doesn’t list it (http://excelribbon.tips.net/Pages/T008319_Understanding_Date_and_Time_Formatting_Codes.html)
    Very cool trick.

  6. Arlyn says:

    News to me. Although, I use Access more than I use Excel. So it is not a surprise.

  7. Rick Rothstein (MVP - Excel) says:

    That formatting also works with the worksheet TEXT function as well…

    =TEXT(A1,”mmmmm”)

    However, it does NOT work with the VB Format function.

  8. Rick Rothstein (MVP - Excel) says:

    Okay, just fooling around I found some other “odd” formatting codes (I’ll show them in quotes to make them stand out, but don’t use quotes when formatting a cell with them).

    1. Using “aaa” seems to do the same thing as “ddd” and “aaaa” seems to do the same thing as “dddd”.

    2. Using “bbb” or “bbbb” returns what looks like a year value that is 543 years ahead of the year in the cell (our 1900 is equivalent to 2443 and this year is equivalent to 2553). Also, using “b” or “bb” returns the last two digits of this “year value”.

    3. Using “e” seems to do the same thing as “yyy” or “yyyy”.

    4. Using “g” seems to make the date display as the empty string.

  9. Rick Rothstein (MVP - Excel) says:

    Okay, just fooling around I found some other “odd” formatting codes (I’ll show them in quotes to make them stand out, but don’t use quotes when formatting a cell with them).

    1. Using “aaa” seems to do the same thing as “ddd” and “aaaa” seems to do the same thing as “dddd”.

    2. Using “bbb” or “bbbb” returns what looks like a year value that is 543 years ahead of the year in the cell (our 1900 is equivalent to 2443 and this year is equivalent to 2553). Also, using “b” or “bb” returns the last two digits of this “year value”.

    3. Using “e” seems to do the same thing as “yyy” or “yyyy”.

    4. Using “g” seems to make the date display as the empty string.

    These codes, like the “mmmmm” which I pointed out in my previous message, work as described within the worksheet’s TEXT function.

  10. Chandoo says:

    new to me.. thanks for the mmmmm

  11. General Ledger says:

    New to me but why use it?

    If you format to display only the first letter of the month name, won’t that lead to confusion: J could be January, June or July.

    How is a user to know which is the correct month?

  12. MMMMM… This is tasty. And useful too.

  13. kJo says:

    Gr8,,

  14. Ute-S says:

    Great tip! Which has traveled to good old Europe now ;-) I tried it in my German version of Excel. It works as well and I will surely mention it in my training courses.
    But in the German version you have to distinguish between (upper-case) M for month and (lower-case) for minute.

  15. Pinaki kar says:

    awsome

  16. chrisham says:

    Awesome, great for some microcharts. Thanks Jon and Thanks Mike!

  17. Fowmy says:

    That’s cool.

    On the date formatting, I would like to share something that I use.

    If you add “b2″ in front of any date format, that would convert the date to Hijri (arabic) calendar date like “b2dd/mm/yyyy.”.

    To add to Rick Rothstein’s finding, formatting a date like dd/mm/bbbb, would convert the date to budhist calendar which is 544 years ahead of gregorian calendar

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>