+ Reply to Thread
Results 1 to 8 of 8

In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

  1. #1
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    I have excel 2007. I have calculate sumifs & maximum date from another sheets with two criteria.
    In summary sheet First criteria : Customer code which is enter in "A" column.
    In summary sheet Second criteria : Series which is enter in "D2 : H2" column.

    Our data records in sheet name "0910", "1011", "1112", "1213", "1314"
    In above all sheet column "C" is customer code, column "S" is series, column "B" is Invoice date and quantity in column "N".

    As per above i required vb macro to calculate in column "D : H" in summary sheet with two criteria customer code column "A" & series in column "D2:H2" from data record sheets

    Summary sheet Calculate sumif with two criteria : (quantity calculate)
    In column "D" : Calculate from sheet 0910
    In column "E" : Calculate from sheet 1011
    In column "F" : Calculate from sheet 1112
    In column "G" : Calculate from sheet 1213
    In column "H" : Calculate from sheet 1314


    Secondly in summary sheet i required to calculate maximum invoice date in column "I" : "M" with same two above criteria i.e. customer code & series. (maximum invoice date)

    Summary sheet calculate maximum invoice date with two criteria:
    In column "I" : Calculate from sheet 0910
    In column "J" : Calculate from sheet 1011
    In column "K" : Calculate from sheet 1112
    In column "L" : Calculate from sheet 1213
    In column "M" : Calculate from sheet 1314

    Right now i am calculate through excel formula. Example in summary sheet in cell "H3"
    =SUMIFS('1314'!$N:$N,'1314'!$C:$C,$A3,'1314'!$S:$S, H$2)
    in cell "M3"
    =MAX(IF(('1314'!$C:$C=$A3)*('1314'!$S:$S=H$2),'1314 '!$B:$B))
    but due to huge data record our calculation time are much more. Hence i required macro.
    I have gone through search engine for similar post but i could not find out which is helpful for me. Hence i have posted new thread.
    In view of the above let me know how to resolve our time factor.
    File attached.
    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: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    I would solve it this way.

    First I run the macro below.

    After that I made an pivot table of that data.

    See the attached file.

    Please reply.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    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 Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    Thanks for reply. That ok for limited data record & customer. But my problem is i have almost 4000 customer and in data data record sheet i have almost 40000 + record.
    But i would like to inform you that, at a glance to find out who's customer buying & how much quantity & what is maximum date (latest purchase date). After that i will trap out those customer who is not buying since before 6 months.

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

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    Please Login or Register  to view this content.
    1) And your array formula is just doing fine?

    Please Login or Register  to view this content.
    2) Did you tried my solutions on your original file (40.000 record / 4.000 customers)?

    3) What is the result of that action?

    Please reply.

  5. #5
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    1) Yes but it will take long period time to calculate. Hence required macro.
    2) Yes.
    3) As per your solutions we find out max date of customer at same time don't find min date customers.

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

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    So the problem in not that's the solution is not working.

    You have just another question.

    1) How do you define min date customers (give several examples).

    2) You have experiance with pivot table?

    3)Please upgrade your profile, so we can see which excel version you use / language settings.

  7. #7
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    Oeldere Sir, The solution works fine.
    1) Actually not a min date. I refer less data (as per your sample solution file) Due to that i am little bit confuse. But not i refer our main file & problem resolved.
    2) yes
    3) Yes upgrade profile.
    I am curious about vb macro. Hence i required macro to calculate fast rather than using formula's. I am not much more familiar with vb.
    I have changed little bit. Attach file.
    pivot.jpg

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

    Re: In Excel 2007 VBA Macro:- Sumif & Maximum Date from another Sheet With Two Criteria

    Please Login or Register  to view this content.
    Notice my main (native) language is not English.

    I don't understand your comment.

+ 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. Excel 2007 : Find out Maximum date with two criteria
    By avk in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 08-11-2013, 06:18 PM
  2. Excel SumIf Formular with date criteria
    By sgbra0 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2013, 07:59 PM
  3. [SOLVED] Calculate due date based on multiple criteria in Excel 2007
    By allienzaddicts in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-21-2013, 04:29 PM
  4. Excel 2007 : SUMIF with 2 criteria
    By pansovic in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-21-2013, 05:42 PM
  5. Excel Date criteria in SUMIF statement help needed
    By imcilwee in forum Excel General
    Replies: 2
    Last Post: 04-04-2012, 05:05 AM

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