+ Reply to Thread
Results 1 to 15 of 15

Copy DATE as TEXT and display MONTH only

  1. #1
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Copy DATE as TEXT and display MONTH only

    Hi guys!

    I am stumped and would appreciate your help!

    I am using the following code in my ThisWorkbook module to copy one field to another when the Workbook is opened:

    Please Login or Register  to view this content.
    BUT, the field I am copying is a date (Format: [$-F800]dddd, mmmm dd, yyyy), and I would like to copy only the month (Format: mmmm) to display the name of the month, BUT as text only, not as a date format or formula etc. I need to use the month in a pivot.

    I would appreciate your help!

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Try:

    Please Login or Register  to view this content.
    You may also want to specify the worksheet...
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    Hi ollyXLS, thanks for the help!

    My problem is, that I not only need the format to be "mmmm" to display the month, I need it to convert the displayed month to text, otherwise the pivot still picks up the original date, as it only displays the month as format, and not text. Any suggestions?

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Quote Originally Posted by onmyway View Post
    Hi ollyXLS, thanks for the help!

    My problem is, that I not only need the format to be "mmmm" to display the month, I need it to convert the displayed month to text, otherwise the pivot still picks up the original date, as it only displays the month as format, and not text. Any suggestions?
    Did you try my code?

  5. #5
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    yes, and it does display the field as mmmm, but in the formula bar it still displays the full date

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Quote Originally Posted by onmyway View Post
    yes, and it does display the field as mmmm, but in the formula bar it still displays the full date
    Not in AR6, it doesn't.

    The FORMAT function takes an expression and returns it as a formatted string.

  7. #7
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    Maybe I am doing something wrong. I have added your code to mine as below:

    Please Login or Register  to view this content.
    But it definitely still shows my AR range as "2013-01-31" values.

  8. #8
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    the format shows January in the column, but 2013-01-31 in the formula bar.

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    1. Replace all your code with mine, the entire subroutine.

    2. Attach your workbook.

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Are you trying to calculate the month (as text) in cell AR6, or in the whole column??! My code above only works with AR6...

    If it's for the whole column, try this:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    The whole column, sorry! Could you perhaps change you last code, to start the range from row 9 - this first 8 rows have formulas and headers and stuff.

  12. #12
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Quote Originally Posted by onmyway View Post
    The whole column, sorry! Could you perhaps change you last code, to start the range from row 9 - this first 8 rows have formulas and headers and stuff.
    You can easily change that - change the 1s to 9s.

  13. #13
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    Legend! Thank you for your patience! You must have been pulling out your hair?!

  14. #14
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy DATE as TEXT and display MONTH only

    Quote Originally Posted by onmyway View Post
    Legend! Thank you for your patience! You must have been pulling out your hair?!
    Glad we got there

    Was my bad, for not taking enough time to understand what your existing code was already doing. I just latched onto the "AR6" reference!

  15. #15
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Copy DATE as TEXT and display MONTH only

    cool, thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Display the first date of the month when the month and year are selected
    By john dalton in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-05-2013, 11:59 AM
  2. [SOLVED] How to display only the month when given date value
    By gmatoka in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-06-2013, 10:17 PM
  3. Covert Date DD/MM/YYYY in to month, with the month as text
    By david1987 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-23-2012, 11:03 AM
  4. Replies: 5
    Last Post: 10-04-2012, 07:06 AM
  5. Display end of month date for previous month
    By erikwvb in forum Excel General
    Replies: 3
    Last Post: 06-20-2011, 01:22 PM

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