+ Reply to Thread
Results 1 to 4 of 4

Delete Columns Macro, Based on Creating a Fiscal Year, Based on Today's Date

  1. #1
    Registered User
    Join Date
    10-28-2016
    Location
    The Moon, Milkyway Galaxy
    MS-Off Ver
    2013
    Posts
    19

    Question Delete Columns Macro, Based on Creating a Fiscal Year, Based on Today's Date

    The doc has several columns such as types of fruit and location picked, then about 15 years, by month, of sale price for the fruit.

    I'd like to create a macro that checks the current date, then removes all columns outisde of the current fiscal year, July to June. So essentially:

    IF today is May 16th, 2018, Remove all columns with month and year between July 2017 - June 2018

    The trick is that we want to keep the original fruit type and location columns. So, only removing the SALE PRICE columns that don't have the current date's fiscal range. (these columns are fixed, luckily, E-BE)


    Ideas?
    Last edited by DemRulesDoe; 05-16-2018 at 10:36 PM.

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Delete Columns Macro, Based on Creating a Fiscal Year, Based on Today's Date

    I'd suggest setting up a second sheet that copies only the columns that you want to keep. If this is of interest, please upload a small desensitized sample spreadsheet showing the layout of the data that you are working with as well as an example of what you expect as an outcome.
    To upload a sample spreadsheet click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    10-28-2016
    Location
    The Moon, Milkyway Galaxy
    MS-Off Ver
    2013
    Posts
    19

    Re: Delete Columns Macro, Based on Creating a Fiscal Year, Based on Today's Date

    I included the simplified document with altered data. There are highlighted yellow and green columns that would be the ideal sections to keep if I had a button for: current fiscal year, and next fiscal year.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Delete Columns Macro, Based on Creating a Fiscal Year, Based on Today's Date

    This proposed formula based solution changes the way that dates are placed into the cells in row 1. Dates are typed in as actual dates for the first of each month (i.e. 6/1/18) then custom formatted yyyy - mmm
    On Sheet 2 cell B1 displays a drop down with choices of either Current or Next
    Cells A2:D8 are populated using: =IF(Sheet1!A1<>"",Sheet1!A1,"")
    Cell F2 is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    - Note that cell C1 has been manually filled so that you can test. Once you have tested, cell C1 could be populated using: =TODAY() or the references to C1 in the formula in cell F2 could be replaced with TODAY() so that it reads:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Cells G2:Q2 are populated using: =DATE(YEAR(F2),MONTH(F2)+1,1)
    Cells F3:Q8 are populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

+ 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] Return a text based on today's date (not considering year)
    By ricdamiani in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2018, 07:19 AM
  2. Calculating year in past and future based on today's date
    By larryd9466 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-09-2016, 01:04 PM
  3. [SOLVED] How to find a value based on fiscal year end
    By cobo1981 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-16-2014, 01:04 PM
  4. Creating a macro to delete columns based on a Range
    By 10999989 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-15-2013, 02:14 AM
  5. how to convert date to fiscal year if fiscal year start at 16th or 17th of July
    By sushil shakya in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2013, 03:32 AM
  6. [SOLVED] Create Fiscal Year - Lookup Date in Fiscal Month Date Range and Return EOM Date
    By gbriscoe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2013, 03:29 PM
  7. Determining Fiscal Year based on date
    By ncmal in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-15-2010, 04:46 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