+ Reply to Thread
Results 1 to 9 of 9

cbbox that will dynamically show current year month and year

  1. #1
    Registered User
    Join Date
    07-16-2022
    Location
    Spain
    MS-Off Ver
    365
    Posts
    7

    Cool cbbox that will dynamically show current year month and year

    I have a combo that currently is populated from a table and I have in the cells:
    Jan-2022
    Feb-2022 and so on until Dec-2022

    Is there a way to make it populate the Month & the current year. So next year the combo will show:

    Jan-2023
    Feb-2023 and so on until Dec-2023

    This way the table stays the same length and I don't need to change the cells manually each year.

    I've done searches but I cant find how to do it.

    I can write the code in vba but don't want a macro in this spreadsheet.

    I tried to concatenate 'Jan' & Year(now()) but couldn't get that to work
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: cbbox that will dynamically show current year month and year

    G2=Month(a2)
    H2=Year(a2
    I2=H2&TEKST(G2;"00")

    There is no need for changing the format, just add the new year (data) in the table.

    After that a pivot table.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

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

    Re: cbbox that will dynamically show current year month and year

    You can use this formula in cell K2:

    =DATE(YEAR(TODAY()),ROWS($1:1),1)

    and then apply a Custom Format to the cell of:

    mmm-yyyy

    Note that due to regional differences, you may need to use semicolons ( ; ) in the formula instead of commas ( , ), and that you may need to use a different format string if the Spanish words for month and year do not begin with m and y.

    You can copy the formula down the table, to give you actual dates rather than text that looks like a date. If you prefer to have the text "dates" then you could use this formula instead:

    =TEXT(DATE(YEAR(TODAY()),ROWS($1:1),1),"mmm-yyyy")

    and the same comments about commas and format string still apply (though you would not have to set a Custom Format).

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    07-16-2022
    Location
    Spain
    MS-Off Ver
    365
    Posts
    7

    Re: cbbox that will dynamically show current year month and year

    Hi I chose to update the table with =DATE(YEAR(TODAY());ROWS($1:1);1) and dragged down and now k2 works and the table will always reflect the current year.

    What it doesn't do now is the filter action. It should take k2 and use that to find the monthyear in the rawdata.

    I think it is close though. it must be a formatting thing.

    I am Pete from the uk too apart from living in Spain now. I had to use semicolons in the functions.

    regards in advance
    Attached Files Attached Files
    Last edited by pb21uk; 07-18-2022 at 01:45 PM.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: cbbox that will dynamically show current year month and year

    Why not just filter on column F.

    See the attached file.

  6. #6
    Registered User
    Join Date
    07-16-2022
    Location
    Spain
    MS-Off Ver
    365
    Posts
    7

    Re: cbbox that will dynamically show current year month and year

    I wanted to keep the user away from the raw data, hence the combo and a dashboard that shows the filtered data.

  7. #7
    Registered User
    Join Date
    07-16-2022
    Location
    Spain
    MS-Off Ver
    365
    Posts
    7

    Re: cbbox that will dynamically show current year month and year

    Quote Originally Posted by Pete_UK View Post
    You can use this formula in cell K2:

    =DATE(YEAR(TODAY()),ROWS($1:1),1)

    and then apply a Custom Format to the cell of:

    mmm-yyyy

    Note that due to regional differences, you may need to use semicolons ( ; ) in the formula instead of commas ( , ), and that you may need to use a different format string if the Spanish words for month and year do not begin with m and y.

    You can copy the formula down the table, to give you actual dates rather than text that looks like a date. If you prefer to have the text "dates" then you could use this formula instead:

    =TEXT(DATE(YEAR(TODAY()),ROWS($1:1),1),"mmm-yyyy")

    and the same comments about commas and format string still apply (though you would not have to set a Custom Format).

    Hope this helps.

    Pete
    I don't understand the rows part of your solution. I have to say it works very nicely but it has affected the filter search now.

  8. #8
    Registered User
    Join Date
    07-16-2022
    Location
    Spain
    MS-Off Ver
    365
    Posts
    7

    Re: cbbox that will dynamically show current year month and year

    Quote Originally Posted by Pete_UK View Post
    You can use this formula in cell K2:

    =DATE(YEAR(TODAY()),ROWS($1:1),1)

    and then apply a Custom Format to the cell of:

    mmm-yyyy

    Note that due to regional differences, you may need to use semicolons ( ; ) in the formula instead of commas ( , ), and that you may need to use a different format string if the Spanish words for month and year do not begin with m and y.

    You can copy the formula down the table, to give you actual dates rather than text that looks like a date. If you prefer to have the text "dates" then you could use this formula instead:

    =TEXT(DATE(YEAR(TODAY()),ROWS($1:1),1),"mmm-yyyy")

    and the same comments about commas and format string still apply (though you would not have to set a Custom Format).

    Hope this helps.

    Pete
    I finally found the problem and it now works, I changed n1 to text function and the filter now works perfectly. How do I add your function as the solution and close the thread?

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

    Re: cbbox that will dynamically show current year month and year

    Quote Originally Posted by pb21uk View Post
    ... How do I add your function as the solution and close the thread? ...
    Well, I think you have already discovered that, as the thread has been marked as SOLVED (using Thread Tools above your first post in this thread). Only Moderators and Admins can close a thread so no further posts can be added.

    Thanks also for the rep.

    Pete

+ 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] Drop Down list showing current month & year and formula to show Prev Year
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-30-2020, 11:54 PM
  2. Replies: 4
    Last Post: 10-07-2018, 04:35 PM
  3. [SOLVED] How to get month and year of previous and current financial year?
    By mso3 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 04-11-2017, 05:19 AM
  4. [SOLVED] Current year and month and Previous and year
    By Anjukeerthi in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-24-2014, 01:23 AM
  5. Change year but keep the month the same based on current year
    By Jamon Fries in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2014, 05:29 PM
  6. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  7. Current Year & Month Name, Previous Year & Month Name
    By mithesh in forum Excel General
    Replies: 9
    Last Post: 10-21-2011, 07:00 AM

Tags for this Thread

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