+ Reply to Thread
Results 1 to 9 of 9

VBA advice on how to handle quarterly sales filtering only.

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    VBA advice on how to handle quarterly sales filtering only.

    Hi All

    Am sitting with a problem and need some input of how to handle quarterly sales filtering...
    Scenario is as follows:
    Every month my report must show only the last 3 months with last month compared to last month of previous year. i.e
    Report Current
    Mar2017 Apr2017 May2017 May2016
    Next Month Report
    April2017 May2017 June2017 June2016
    Following Month Report
    May2017 June2017 July2017 July2016
    etc
    Have a spreadsheet with Headings Jan - Dec
    Would I tackle this with code to hide columns based on Current month and code to populate previous year month with current month search in last years figures?

    Have no clue where to start...Any input would be valuable.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA advice on how to handle quarterly sales filtering only.

    Hmm, normally I'd leverage data model along with PivotTable for this type of thing. But since you have 2007, data relationship isn't available.

    I'd probably start from tranforming/merging data into single flat table for both year (or for each year) and then summarize using formula or pivot table.

    Using VBA to dynamically filter pivottable.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA advice on how to handle quarterly sales filtering only.

    Hi CK76

    Thanx for input...My pet hate is Pivot Tables...lol...Perhaps cause I have had little or no experience with them.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA advice on how to handle quarterly sales filtering only.

    How about this

    Select value in cell A1 for your 4 columns
    (Double click in cell A1 to show all columns)


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA advice on how to handle quarterly sales filtering only.

    Hi all

    Have come up with code to handle the filter:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA advice on how to handle quarterly sales filtering only.

    Hi kev_

    Awesome solution...Quick question:
    If the previous years figures were on a separate sheet called 2016 Columns B through M...
    How would you adapt code?

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA advice on how to handle quarterly sales filtering only.

    If you want to use different sheets for the data in different years then hiding & unhiding will not work
    Select value in dropdown in A1 in sheet "Report"

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA advice on how to handle quarterly sales filtering only.

    Nice one kev_

    Thanks...Will most certainly make use of.

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA advice on how to handle quarterly sales filtering only.

    or .... create a lookup table to tell VBA where to find the 4 columns - which simplifies the code

    In attached workbook
    - Table2 contains a list of the 24 months and where to find them
    - Table1 looks up Table2
    - VBA uses Table1 to paste the 4 columns
    Please Login or Register  to view this content.
    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. Weekly, Monthly, Quarterly & Yearly Sales Dashboard
    By Neilesh Kumar in forum Excel General
    Replies: 0
    Last Post: 06-07-2016, 08:21 AM
  2. Replies: 8
    Last Post: 11-03-2015, 07:52 PM
  3. [SOLVED] sum sales quarterly each salesperson
    By ashishraj in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-18-2013, 05:01 AM
  4. General Advice (Filtering & Sorting)
    By demonfly100 in forum Excel General
    Replies: 0
    Last Post: 01-29-2013, 05:20 AM
  5. quarterly/weekly sales tracking with variable dates
    By blufyre in forum Excel General
    Replies: 1
    Last Post: 01-15-2012, 05:12 AM
  6. advice on automating sales data
    By appraiser john in forum Excel General
    Replies: 1
    Last Post: 05-05-2008, 11:44 PM
  7. [SOLVED] Excel - sum a column of sales monthly and quarterly?
    By HarryMangurian in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-16-2005, 08:06 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