Formula - Return month as text from a date cell.

I want to use the formula:

=TEXT(*CELL WITH DATE*,"mmmm")

But this doesn't seem to be a valid formula on Smartsheet.

So if I have a cell with the date "01/01/19" - I want it to show "January" in another cell.

Best Answer

«1

Answers

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    Here's what I do:

    I have a sheet called "Date Tables". In that sheet I have a column for Month Number and another for Month Name.

    1 January

    2 February

    3 March

    4 April

    5 May

    6月6日

    7 July

    8 August

    9 September

    10 October

    11 November

    12 December

    I use X-Sheet references to get the name from the number.

    Like this:

    =IFERROR(INDEX({Date Tables | Month Name}, MATCH(MONTH(Start@row), {Date Tables | Month Num}, 0)), "")

    You only need to set up the X-Sheet references once per sheet.

    Alternatively, you can build a complicated nested-if statement, but I won't.

    Craig

  • Hey,

    Thanks very much for this, however, wow, its a rather convoluted work-around for what you'd think should be a simple formula. I'll try it out.

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    There are posts on the Community with the nested-if example. That's worse.

    Before X-Sheet references, I would have the data on a hidden area of the sheets.

    Since I just copy/paste the formulas, it only take a minute or two to setup a new sheet for the functionality.

    Craig

  • Hey Craig - I have created my date tables sheet, and am trying to build out my formula to replicate this but am having a hard time dissecting your formula to adjust to my sheet names, etc.

    Can you break it down for me?

    =IFERROR(INDEX({Date Tables | Month Name}, MATCH(MONTH(Start@row), {Date Tables | Month Num}, 0)), "")

    Thank you!

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    Yep.

    =IFERROR(INDEX({Date Tables | Month Name}, MATCH(MONTH(Start@row), {Date Tables | Month Num}, 0)), "")

    MATCH( the month of the date in the [Start] column on this row with the column of data called {Date Tables | Month Num} -- which is a single column of the numbers 1-12.

    The last argument (0) is habit and is looking at an unsorted list.

    This returns the row number (within the table), so 2018-06-06 would search for 6 and find it on the 7th row (since my table has a header)

    指数这一行(在我们的例子中7)和数量returns the matching value from the column of data called {Data Tables | Month Name} -- another single column with the text of the month's names.

    I use INDEX(...,MATCH()) in case someone decides to change the order of the columns, put something between them, or otherwise mess up what I might think of as a beautiful table, perfect in form.

    Lastly, I wrap it in IFERROR (returning a blank if one is found) because MONTH() throws an error on blanks.

    See image for what the data looks like

    Craig

    DateTables_Month.png

  • Barry Bowles
    Barry Bowles ✭✭✭✭
    edited 05/05/19

    I agree Smartsheet should have a way to format these cells with the Text value of the dates - not very "smart" when compared to Excel.

    Its hard to avoid some complexity here but I used a different method only because I am more familiar with these functions. I created master "Lookup Sheet" which can be referenced by any sheet in any workspace and just used the simple table of Month number and Month Name same as Craig did and used Vlookup function.

    Smartsheet already allows me to force a date value in the lookup column so I did not need to put an error checking component in other than checking for an empty cell with a simple IF statement but could just as easily use the ERROR function.

    =IF([Date]1= "", "", VLOOKUP(MONTH([Date]1), {Lookup Sheet1}, 2, false))

    [Date]1 is the cell I am getting the date from to convert to Month name

    {Lookup Sheet1} is the range on the Lookup Sheet

  • =IF(MONTH(cell with date) = 1, "January" ect function works wonders here. Much easier than listed above.

  • So I just created a sheet with primary column having each row with the month number and column two with the month written as text e.g January

    Then in the primary sheet added the following formula as a VLOOKUP and set as a column formula.

    =VLOOKUP(MONTH([date_invoice]@row), {Months Range 1}, 2, false)

    Would be nice if there was a formula but the above is a basic workaround without making it overly complicated given the lack of built in function.

  • Try this

    =IF(Month@row = "December",12,IF(Month@row = "November",11,IF(Month@row = "October",10,IF(Month@row = "September",9,IF(Month@row = "August",8,IF(Month@row = "July",7,IF(Month@row = "June",6,IF(Month@row = "May",5,IF(Month@row = "Apirl",4,IF(Month@row = "March",3,IF(Month@row = "February",2,IF(Month@row = "January",1,0))))))))))))

  • Or

    =IF(Month@row = 12,"December",IF(Month@row = 11,"November",IF(Month@row = 10,"October",IF(Month@row = 9,"September",IF(Month@row = 8,"August",IF(Month@row = 7,"July",IF(Month@row = 6,"June",IF(Month@row = 5,"May",IF(Month@row = 4,"April",IF(Month@row = 3,"March",IF(Month@row = 2,"February",IF(Month@row = 1,"January",0))))))))))))

  • Cleversheet
    Cleversheet ✭✭✭✭✭✭

    In case you only need to isolate and "numerize" the month from a textual date, you can simply adapt one of the formulas found inthis sheet.

  • Adrian Mandile CHESS
    Adrian Mandile CHESS ✭✭✭✭✭

    The TEXT() function is LOOOONG overdue! Please Smartsheet, an update to some additional handy intrinsic functions should be in the 'Coming Soon' Roadmap - they can't be that difficult to code.

  • Cleversheet
    Cleversheet ✭✭✭✭✭✭

    @Adrian @ Chess

    Is this what you mean? If so, not too hard.

    =TODAY(1) + ""

    yields, for example, “10/10/2018”

    The + "" will convert the formula in the parenthesis () to text.

    Thanks to J Craig Williams in the Smartsheet Community

  • Adrian Mandile CHESS
    Adrian Mandile CHESS ✭✭✭✭✭

    Thanks@Cleversheet, but no.

    I'm after the flexibility that Excel has had since day dot. To format text from a cell however I want.

    Using the following function syntax:

    =TEXT (cell, format)

    So, if cell value is date of 10/10/2018, I can format it like "dddd dd ddd, yyyy" to get "Wed 10 Oct, 2018"

    Or if cell value is 7135551234, I can format it as a phone number "(###) ###-####' to get "(713) 555-1234"

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
@Bob Schweighart<\/a> you just need the COUNTIFS formula and put those 2 criterion in it. Are they distinct counts for the 4 different projects? If so, that is easier. If you are counting all 4, then you need to decide on an imbedded OR or a NOT.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":112242,"type":"question","name":"Can I use Index\/Match and Left functions in one formula?","excerpt":"Hello, can someone help me with the left function within the index\/match? This is what I tried but it always returns NO MATCH: =INDEX({Master Job SO}, MATCH(LEFT([Job Number]@row,5), {Master Job #}, 0)) I also tried creating a helper column, Job Prefix, using =LEFT([Job Number]@row, 5) and using that result in the SO…","snippet":"Hello, can someone help me with the left function within the index\/match? This is what I tried but it always returns NO MATCH: =INDEX({Master Job SO}, MATCH(LEFT([Job…","categoryID":322,"dateInserted":"2023-10-26T22:39:07+00:00","dateUpdated":null,"dateLastComment":"2023-10-27T17:46:03+00:00","insertUserID":157316,"insertUser":{"userID":157316,"name":"amber.lange","url":"https:\/\/community.smartsheet.com\/profile\/amber.lange","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T20:44:40+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":157316,"lastUser":{"userID":157316,"name":"amber.lange","url":"https:\/\/community.smartsheet.com\/profile\/amber.lange","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T20:44:40+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":32,"score":null,"hot":3396791110,"url":"https:\/\/community.smartsheet.com\/discussion\/112242\/can-i-use-index-match-and-left-functions-in-one-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/112242\/can-i-use-index-match-and-left-functions-in-one-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":112242,"commentID":402089,"name":"Re: Can I use Index\/Match and Left functions in one formula?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/402089#Comment_402089","dateInserted":"2023-10-27T17:46:03+00:00","insertUserID":157316,"insertUser":{"userID":157316,"name":"amber.lange","url":"https:\/\/community.smartsheet.com\/profile\/amber.lange","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T20:44:40+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/RTC0V6MZN24K\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-27T17:46:07+00:00","dateAnswered":"2023-10-27T17:30:20+00:00","acceptedAnswers":[{"commentID":402081,"body":"

There we go. The [SO] column looks like it is being manually populated which is storing the data as numerical data, but the LEFT function outputs text.<\/p>


<\/p>

Insert a column on the reference sheet and use<\/p>

=SO@row + \"//www.santa-greenland.com/community/discussion/comment/82451/\"<\/p>

plus quote quote<\/p>


<\/p>

This will convert all entries into a text string so that data types match. You would then match on this helper column in your INDEX\/MATCH.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":112223,"type":"question","name":"How to pull the most recent status symbol from another sheet?","excerpt":"Hello, I am trying to pull the most recent status symbol based off of the most recent date to another sheet. Basically, I am trying to get the yellow status symbol from the 20th to pull into another sheet and once someone creates a new update with the most recent date\/symbol, that symbol should be automatically updated…","snippet":"Hello, I am trying to pull the most recent status symbol based off of the most recent date to another sheet. Basically, I am trying to get the yellow status symbol from the 20th…","categoryID":322,"dateInserted":"2023-10-26T17:10:42+00:00","dateUpdated":null,"dateLastComment":"2023-10-27T20:14:26+00:00","insertUserID":169134,"insertUser":{"userID":169134,"name":"Brittaney Pizzato","url":"https:\/\/community.smartsheet.com\/profile\/Brittaney%20Pizzato","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T21:30:52+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":169134,"lastUser":{"userID":169134,"name":"Brittaney Pizzato","url":"https:\/\/community.smartsheet.com\/profile\/Brittaney%20Pizzato","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T21:30:52+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":33,"score":null,"hot":3396779108,"url":"https:\/\/community.smartsheet.com\/discussion\/112223\/how-to-pull-the-most-recent-status-symbol-from-another-sheet","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/112223\/how-to-pull-the-most-recent-status-symbol-from-another-sheet","format":"Rich","lastPost":{"discussionID":112223,"commentID":402114,"name":"Re: How to pull the most recent status symbol from another sheet?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/402114#Comment_402114","dateInserted":"2023-10-27T20:14:26+00:00","insertUserID":169134,"insertUser":{"userID":169134,"name":"Brittaney Pizzato","url":"https:\/\/community.smartsheet.com\/profile\/Brittaney%20Pizzato","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-27T21:30:52+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/F30QLRHNUSZM\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-26T20:42:55+00:00","dateAnswered":"2023-10-26T20:32:57+00:00","acceptedAnswers":[{"commentID":401926,"body":"

Hi @Brittaney Pizzato<\/a> - You would match the max date against the date column, and you don't need Collect in this scenario, so it could read as =INDEX({Project Health}, MATCH(MAX({Date}), {Date}, 0))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Formulas and Functions