+ Reply to Thread
Results 1 to 5 of 5

Countifs and Sumifs VBA code with criterias between 2 date range

  1. #1
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Countifs and Sumifs VBA code with criterias between 2 date range

    Hi Guys,

    I need your help to make a code of how to do countifs and sumifs alike function in VBA that can run much more faster than formula due to i have a very large sets of data. Basically what i want to do is for the code to search the ID ( Member ID ) of customer and then see if the date fall between the range of purchase and 14 days after. I have attached a sample workbook for your better reference. Please kindly ask me if there is anything unclear. Thanks for the time.

    Countif and sumifs VBA code based on criterias between date range ( forum Q ).xlsx
    Last edited by Jul Stev; 12-04-2013 at 03:17 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Countifs and Sumifs VBA code with criterias between 2 date range

    Set the calculation of the file to Manual and Press F9 whenever you need to calculate the formula’s.

    You can use multiple criteria with Array combination like this….

    =SUM(COUNTIFS(Data!A:A,{29653,24142,28140},Data!B:B,">="&B2,Data!B:B,"<="&C2))

    If you want to keep those multiple criteria’s in cells then try like this…

    =SUMPRODUCT(COUNTIFS(Data!A:A,G1:G3,Data!B:B,">="&B2,Data!B:B,"<="&C2))

    Range G1:G3 refers to the below Criteria Values
    29653
    24142
    28140


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Countifs and Sumifs VBA code with criterias between 2 date range

    Hi Sixthsense,

    Thanks for your response, but i think you misunderstood my request, sorry if i didnt explain it clear enough. The resuts on range D2:E21 is the correct result that i want to get, but due to my Large actual set of data i'm forced to seek another way to get this results , all i can think is using VBA code that i hope it will run much faster than my current countifs and sumifs formula, when i run my formulas in my actual data it took around 10 minutes to run the countifs only. I try your formula but i see that it didnt refer to the member ID but what i want to get is the count of each member in report sheets that get the data from Data sheet based on the date.

    The purpose i need to do this is because the CS department in our company make a call to our customers ( all the customers that has been called is on report sheet ). So we want to see whether the customer purchase anything after 7days the call been made , how many times they purchase and how much is the amount. Please kindly ask me again if there is still anything unclear.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Countifs and Sumifs VBA code with criterias between 2 date range

    Ok.. it's clear now and thanks for the brief

    Just give the sheet names and range references on which the macro needs to be applied with the formula ranges/formula.
    Last edited by :) Sixthsense :); 12-04-2013 at 05:25 AM.

  5. #5
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Countifs and Sumifs VBA code with criterias between 2 date range

    Hi sixthsense,

    Actually you can just apply the code to the workbook that i attached and i will try to apply it on my workbook because i also want to learn..just don't know how to start to make the code , Thanks in advance for your help.

+ 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] Need Advices - Alternative to COUNTIFS - 3 Criterias!
    By codeslizer in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-07-2013, 12:58 AM
  2. [SOLVED] countif/sumif with more criterias - too complex for countifs/sumifs
    By Mengo85 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-03-2013, 07:18 AM
  3. [SOLVED] SUMIFS only returns the 1st matched value in my range of criterias
    By catzilla in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-30-2012, 11:55 AM
  4. Sumifs with multiple criterias
    By gnoke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2012, 05:51 AM
  5. SUMIFS with multiple criterias row/colums
    By btem in forum Excel General
    Replies: 8
    Last Post: 09-22-2011, 11:04 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