Formula to extract month and day and convert to month abbreviation and week number
Power Query Course in Spanish
Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Formula to extract month and day and convert to month abbreviation and week number

  1. #1
    Board Regular
    Join Date
    Aug 2014
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Formula to extract month and day and convert to month abbreviation and week number

     
    Hello.

    Seeking a formula to extract details from the CURRENT DATE START (E) cell to populate in the MONTH (A) cell and the WEEK (B) cell instead of me manually entering the month and week- appreciate your help in advance. Thank you.

    --- Michael

    A B C D E F G H
    MONTH WEEK PAST DATE START PAST DATE END CURRENT DATE START CURRENT DATE END FUTURE DATE START FUTURE DATE END
    Oct 4 Sun, Oct 1, 2017 Mon, Oct 30, 2017
    Oct 4 Sun, Oct 1, 2017 Mon, Oct 30, 2017
    Jan 4 Sun, Jan 1, 2017 Tue, Jan 30, 2018
    Jan 4 Sun, Jan 1, 2017 Tue, Jan 30, 2018
    Sep 1 Fri, Sep 1, 2017 Sun, Sep 30, 2018
    Jul 2 Sun, Jul 1, 2018


  2. #2
    Board Regular wideboydixon's Avatar
    Join Date
    Jun 2016
    Location
    Sheffield, UK
    Posts
    3,092
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    In A2 you can simply put:

    Code:
    =$E2
    And format the cells as "mmm". Alternatively you could use:

    Code:
    =TEXT($E2,"mmm")
    For column B, I don't understand how you get those numbers. I thought you would just be putting

    Code:
    =WEEKNUM($E2)
    But that does give your example values.

    WBD
    Excel 2016 on Windows 10.
    Please use [code] tags when posting code.
    Please post data in proper tables - I suggest this tool.
    Remember to make a copy of your spreadsheet before running any macros that might change the data - macros can't be undone!

  3. #3
    MrExcel MVP VBA Geek's Avatar
    Join Date
    Dec 2013
    Location
    Kepler 438B
    Posts
    2,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    what is the rationale behind the week number?

  4. #4
    Board Regular
    Join Date
    Aug 2014
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    Quote Originally Posted by VBA Geek View Post
    what is the rationale behind the week number?
    Thank you for asking- this data is part of an event planning spreadsheet that can sort events and associated tasks in many ways including the month and week they happen in- in order for task owners to plan two years out.

  5. #5
    Board Regular
    Join Date
    Aug 2014
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    Hello. =$E2 does not render "Oct" only but rather duplicates the cell in E2

    =$E2

  6. #6
    Board Regular wideboydixon's Avatar
    Join Date
    Jun 2016
    Location
    Sheffield, UK
    Posts
    3,092
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    Select column A, press Ctrl+1, go to the Number tab, select Custom and enter "mmm" (without quotes) in the Type: field.

    WBD
    Excel 2016 on Windows 10.
    Please use [code] tags when posting code.
    Please post data in proper tables - I suggest this tool.
    Remember to make a copy of your spreadsheet before running any macros that might change the data - macros can't be undone!

  7. #7
    Board Regular wideboydixon's Avatar
    Join Date
    Jun 2016
    Location
    Sheffield, UK
    Posts
    3,092
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    Quote Originally Posted by wmichael View Post
    Thank you for asking- this data is part of an event planning spreadsheet that can sort events and associated tasks in many ways including the month and week they happen in- in order for task owners to plan two years out.
    I think the question was "how do you calculate column B?"

    WBD
    Excel 2016 on Windows 10.
    Please use [code] tags when posting code.
    Please post data in proper tables - I suggest this tool.
    Remember to make a copy of your spreadsheet before running any macros that might change the data - macros can't be undone!

  8. #8
    Board Regular
    Join Date
    Aug 2014
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    Quote Originally Posted by wideboydixon View Post
    I think the question was "how do you calculate column B?"

    WBD
    To calculate column B: if the day of the month is 1-7 the B would equal the number one. if the day of the month is 8-14 the B would equal the number two. if the day of the month is 15-21 the B would equal the number three. if the day of the month is 22-31 the B would equal the number four.

  9. #9
    Board Regular wideboydixon's Avatar
    Join Date
    Jun 2016
    Location
    Sheffield, UK
    Posts
    3,092
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

    That doesn't match with your data. All dates are 1st of the month so all weeks should be 1. However, for that calculation in B2:

    Code:
    =INT((DAY(E2)-1)/7)+1
    WBD
    Excel 2016 on Windows 10.
    Please use [code] tags when posting code.
    Please post data in proper tables - I suggest this tool.
    Remember to make a copy of your spreadsheet before running any macros that might change the data - macros can't be undone!

  10. #10
    Board Regular
    Join Date
    Aug 2014
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Seeking formula to extract month and day and convert to month abbreviation and week number

      
    Quote Originally Posted by wideboydixon View Post
    That doesn't match with your data. All dates are 1st of the month so all weeks should be 1. However, for that calculation in B2:

    Code:
    =INT((DAY(E2)-1)/7)+1

    WBD
    You are correct and thank you for calling out any confusion. My statement does not match my data, which is poor editing on my part before posting, but my statement is the result I am seeking.

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com