+ Reply to Thread
Results 1 to 5 of 5

Countifs with multiple criteria and data range

  1. #1
    Registered User
    Join Date
    10-21-2016
    Location
    Ireland
    MS-Off Ver
    10
    Posts
    19

    Countifs with multiple criteria and data range

    Hi all,

    Been using your site for a while now to get answers to problems but cant seem to solve this one so need some advice!

    So Im having some issues using a countIfs with a date range. The purpose is to count a total amount of individual ID's that visit us based on a date range. We want to see how many come back in on the same day, within 3 days and within 30 days.

    So my forumla for the within one days is:

    =IF(COUNTIFS('Returned'!A:A,'Overall Data'!B1,'Returned'!B:B,'Overall Data'!A1)>0,"Yes","No")

    For within 3 days:

    =IF(COUNTIFS('Returned'!A:A,'Overall Data'!B1,'Returned'!B:B,">=" &A1+2)>0,"Yes","No")

    For within 30 days:

    =IF(COUNTIFS('Returned'!A:A,'Overall Data'!B1,'Returned'!B:B,">=" &A1+29)>0,"Yes","No")

    Where Returned A:A is the ID, Returned B:B is the date and Overall data A:A is Date and B:B is ID.

    The issue I am receiving is that all the data for within 30 days is lower than the data for within 3, essentially data returned for within 30 days should be higher as they have returned within 3 therefore the should have also returned within 30. Another issue is the file is massive (around 500k lines) so complex and long line formula are difficult to run so it needs to be short an elegant, any help is highly appreciated!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Countifs with multiple criteria and data range

    If I understand correctly (it's difficult to envisage your requirements without seeing a workbook), I think you need to do it like this:

    =IF(COUNTIFS('Returned'!A:A,'Overall Data'!B1,'Returned'!B:B,">=" &A1,'Returned'!B:B,"<=" &A1+29),"Yes","No")

    and if the formula is in the Overall Data sheet then you can remove the sheet reference to shorten the formula, like this:

    =IF(COUNTIFS('Returned'!A:A,B1,'Returned'!B:B,">=" &A1,'Returned'!B:B,"<=" &A1+29),"Yes","No")

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    10-21-2016
    Location
    Ireland
    MS-Off Ver
    10
    Posts
    19

    Re: Countifs with multiple criteria and data range

    Hey Pete,

    Thanks for the reply, this is working a treat! Thanks so much!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Countifs with multiple criteria and data range

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Countifs with multiple criteria and data range

    I also meant to point out that you should do a similar thing with your formula to count up to 3 days - as it stands, your formula counts the number of entries where the date is greater than or equal to A1 + 2.

    Hope this helps.

    Pete

+ 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. Countifs with multiple criteria in single criteria range
    By MCP313 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-01-2016, 03:51 AM
  2. [SOLVED] COUNTIFS with multiple criteria in the same criteria range
    By Faridwahidi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-23-2015, 01:04 PM
  3. [SOLVED] COUNTIFS multiple criteria (date range & text)
    By jholiday78 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-30-2014, 06:36 PM
  4. [SOLVED] Can I count data in COUNTIFS by using a range of other data for in criteria.
    By jnmturner in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-06-2013, 06:45 AM
  5. COUNTIFS with Multiple Criteria in One Range
    By mphillips in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-19-2013, 02:43 PM
  6. Countifs with multiple criteria in a single range
    By Wolfpackfan320 in forum Excel General
    Replies: 1
    Last Post: 02-27-2012, 04:54 PM
  7. Replies: 0
    Last Post: 07-27-2011, 01:00 AM

Tags for this Thread

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