+ Reply to Thread
Results 1 to 3 of 3

Macro to enter totals into columns on dates

  1. #1
    Registered User
    Join Date
    08-07-2009
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Macro to enter totals into columns on dates

    Hi, i have a range of data in one sheet which has a reference number and amount & dates, so i wrote a push button macro to arrange the data into a pivot table and total by the reference numbers and the month the spend incurred.

    Next on my forecast sheet the reference numbers are on the far left array and now i'm stuck because i want these totals by ref number and date (month)to go in my forecast sheet by month (obviously at the top of the sheet) searching by reference number on the far left and looking at the month at the top on the sheet and been entered into the corresponding columns on the spreadsheet

    I.e

    Month Column
    Jan Feb March April May Jun July

    Ref Number 1234
    Ref Number 4567

    How would i go about doing this shoudl i use =if statement by referencing the pivot table results which seems easy, but how would i write a forumula to take into account the dates the costs came in a double vlookup??

    please help!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro to enter totals into columns on dates

    the layout of your PT is not clear - are you Grouping by Month & Year in the PT ? If so, why not use the GETPIVOTDATA function rather than conducting otherwise expensive formulae to generate the totals... you can adjust the generated GETPIVOTDATA field values (constants) for cell references such that the function becomes dynamic and can be copied across your matrix.

    If the above is not viable for whatever reason then assuming you have a relatively large amount of data to deal with @ source I would strongly advise using Concatenation on source sheet to avoid need for SUMPRODUCT / Arrays... to provide a more detailed example we would need a dummy file with which to work which illustrates exactly how your data is laid out.

  3. #3
    Registered User
    Join Date
    08-07-2009
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro to enter totals into columns on dates

    Hi D, i'll try to make a sample sheet and send it over, the data is sensitive so i clean it up, but thanks for your suggestion the GETPIVOTDATA function sounds viable but there is a vast amount of data which changes month by month,

    The pivot Groups the total spends by the Ref: No, then by Month

    But thank you for your advice and i'll see if i can get a sample sheet over to you.

    The only reason i created a pivot table as there is alot of data and the pivot helps capture the totals easily and if i could capture these totals again into the forecast that would be supreme.

    Thanks Again will be in touch

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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