+ Reply to Thread
Results 1 to 5 of 5

Convert Name of month to a number

  1. #1
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Convert Name of month to a number

    I am trying to convert the name of a month to a number but there is a slight issue with using my normal method of TEXT("1/"&A1&"/2013","mmm")

    I am trying to create a dynamic table which if you change 1 value for the month, it changes others

    so my data looks like so,

    Jan
    Feb
    Mar
    Apr
    May <---- this is the value which is chosen

    the problem is when I select the month "January", it assigns the value of the above cell as 1/0/2013 which is not a date when in fact I want to set it as "December"

    im not sure if I am making my problem clear but hopefully someone can understand where my problem lies.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,440

    Re: Convert Name of month to a number

    Not quite sure what you mean - can you attach a sample workbook which illustrates the problem better?

    Pete

  3. #3
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Convert Name of month to a number

    Hi penfold1992

    Assuming in A1: Jan
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    is that something you could work with!
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  4. #4
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Convert Name of month to a number

    =TEXT("1/"&(IF(P11>12,P11-12,P11))&"/2013","mmm")

    this is what I have used....
    in P11 i have
    =(MONTH(DATEVALUE(README!$B$19&" 1")))+12 <--- this number needs to have +12 because it is referenced in an INDEX.

    which is why I have the (P11-12)

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,440

    Re: Convert Name of month to a number

    Here's a different way of doing it:

    =MATCH(P11,{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0)

    Hope this helps.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1