+ Reply to Thread
Results 1 to 21 of 21

Counting unique values with multiple criteria. Not working when including Date in Formula

  1. #1
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Counting unique values with multiple criteria. Not working when including Date in Formula

    With below formula I am counting unique values. Everything was working well until I added the dates. Any suggestions to solve this?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thanks
    Thomas
    Attached Files Attached Files
    Last edited by thomasuponor; 02-19-2021 at 07:34 AM. Reason: Sample file attached + Title changed

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    46,872

    Re: Counting unique values with FREQUENCY, ISNUMBER, SEARCH, and MATCH

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Your title does not mention dates at all!!!

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with FREQUENCY, ISNUMBER, SEARCH, and MATCH

    Please add a sample sheet, too (yellow banner, top of page). It makes it easier if we can SEE what we're dealing with...
    Glenn



  4. #4
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Hi both, thanks for letting me know
    Sample file attached and title is now changed.
    Hope everything is OK now.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    This is HUGELY slow. Do you REALLY Have 1,000,000 rows????

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Since you have O365, you can use a combination of dynamic arrays:

    =COUNTA(UNIQUE(FILTER(F2:F100,(D2:D100>=DATE(2020,1,1))*(D2:D100<=DATE(2020,12,31))*(ISNUMBER(SEARCH("Visit",I2:I100)))*(J2:J100="Ole Olsen")*(N2:N100="Installer/Contractor"),"")))


    I am completely confused about what you THINK this bit is doing:

    (ISNUMBER(SEARCH("|"&visits!I:I&"|";"|Visit|Online Meeting|Webinar|Join Visit|")))

    in your original formula. Please explain!!
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Hi Glenn,
    Sorry for bringing misinformation. My version is 2016 (is corrected now).

    About the bit: This part of the formula is counting "Visit", "Online Meeting", "Webinar" OR "Join Visit".
    In the sample file all values are "Visit". But it could easily be one of the other.

    Hope it makes sense.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    OK. Back to the drawing board. BUT NEVER use whole column references in array formulae. That formula takes SECONDS to calculate. How many rows (maximum) do you REALLY have?

  9. #9
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Oh yeah. You are very right. I only have 10000 rows.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    OK. I have set it here for 10000 rows. It is still slow... but not as slow... it does have more work to do, though...


    =SUM(INDEX((D2:D10000>=DATE(2020,1,1))*(D2:D10000<=DATE(2020,12,31))*(F2:F10000<>"")*(J2:J10000="Ole Olsen")*(ISNUMBER(SEARCH({"¦Visit¦","¦Online Meeting¦","¦Webinar¦","¦Join Visit¦"},"¦"&I2:I10000&"¦")))/COUNTIFS(I2:I10000,I2:I10000&"",J2:J10000,J2:J10000&"",N2:N10000,N2:N10000&"",F2:F10000,F2:F10000&""),0))


    Glenn
    Attached Files Attached Files

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Check to see if it has the array formulae {} round it, on receipt. I am not sure, but the addition of the pipe round column I (to prevent double counting of Visit and Join Visit) may mean that you will have to enter it as an array in your version of Excel.

  12. #12
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Looks very good. I just tried on the sample file and the result is 1.
    I have replaced , with ; and tried with and without {}.
    Result should be 9.

    Also noted the part of formula is missing: N2:N1000="Installer/Contractor"

    Thomas

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    What did you see when you opened MY file, with the formula in place (yellow cell)?

  14. #14
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Hold on. I just checked your sample file and you have used "\". I have added ="Installer/Contractor" and it's working perfectly now.
    Formula looks like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    So... when you opened it, the formula array (the bit inside the {} in the middle of the formula) appeared as "\" it left here as a comma!! I thought it MIGHT have turned into a semicolon... but wasn't expecting that!!

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

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

  16. #16
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Hold on again
    I tested on bigger amount of data and the result turn out as decimal number (should be impossible)
    Let me attached in 2 sec.

  17. #17
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Bigger sample attached.
    Attached Files Attached Files

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    Oh dear... is it really more than an hour since I opened this!!??

    Try it now. Too big to check manually... but it is returning an integer!!
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    I managed to make below formula work. It's very similar to the initial and the result is correct. The only difference is the part with the date.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,839

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    I see that you are using whole column references in your formula again.

  21. #21
    Registered User
    Join Date
    05-25-2020
    Location
    Denmark
    MS-Off Ver
    Professional Plus 2016
    Posts
    50

    Re: Counting unique values with multiple criteria. Not working when including Date in Form

    ohhh. thought you wouldn't notice. lol

+ 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] Using ISNUMBER SEARCH with INDEX MATCH
    By Emile du Toit in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-15-2020, 08:54 AM
  2. Index/Match or If/isnumber/search Question
    By S Thibault in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2019, 01:19 AM
  3. [SOLVED] isnumber search match error
    By Neilesh Kumar in forum Excel General
    Replies: 5
    Last Post: 07-01-2018, 06:07 AM
  4. [SOLVED] Need Help Counting Unique Values If 2 Columns Match
    By Xeba37 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-10-2016, 05:29 AM
  5. [SOLVED] Using INDEX MATCH to return unique values for non-unique search term
    By rico_suave in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-03-2015, 01:53 AM
  6. Counting Frequency of duplicates for each unique value and corresponding data
    By fredman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2009, 12:55 AM
  7. Combining if(isnumber(search with Frequency
    By Marshall101 in forum Excel General
    Replies: 5
    Last Post: 10-15-2008, 10:15 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