+ Reply to Thread
Results 1 to 15 of 15

Count Unique based on date

  1. #1
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Unhappy Count Unique based on date

    I am trying to count the unique entries in a field. Based on the date it was entered into the sheet.


    Column A - Date Entered on to Sheet
    Column C - Order No.

    There could be more than one instance of an Order Id on the sheet as it could relate to multiple items on the order.

    For the first part I am trying to find out a count of unique order ID that was on the sheet before a certain date. There will never be anything on the sheet that is dated after "=today()". to explain the formula I am using below - cell A9 relates to a date e.g 22.08.11
    column a on back order summary sheet is the date entered on sheet and column c refers to the order id.

    {=COUNT(IF(FREQUENCY(IF('BackOrder Summary'!$A$2:$A$437<Summary!$A$9,MATCH('BackOrder Summary'!$C$2:$C$437,'BackOrder Summary'!$C$2:$C$437,0)),ROW('BackOrder Summary'!$A$2:$A$437)-ROW(Summary!$A$9)+1),))}

    as a seperate function i am also looking to capture the count of unique order id's entered onto the sheet that day, i presume i can change the formula where it looks at "..<Summary!$A$9" to "...=Summary!$A$9"

    if anyone can help as I am currently not getting the expected result.

    Thanks

    Dan
    Last edited by dab1988; 08-24-2011 at 03:34 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    So the formula doesn't work? It seems right.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    I thought the forumla was correct as well but when I pivot the data to cross check and place the "Date added to report" into the report filter I get a different count to what its saying as a result of the forumla. I am baffled.

    For example. I have around 30 unique additions to the data in terms of unique order numbers on the 22.08.11. but when i run the forumla -

    {=COUNT(IF(FREQUENCY(IF('BackOrder Summary'!$A$2:$A$437=Summary!$A$9,MATCH('BackOrder Summary'!$C$2:$C$437,'BackOrder Summary'!$C$2:$C$437,0)),ROW('BackOrder Summary'!$A$2:$A$437)-ROW(Summary!$A$9)+1),))}

    where Summary!$A$9 = 22.08.11 in the workbook it brings back "2" as the answer, which is clearly wrong.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    You are confirming the formula with CTRL+SHIFT+ENTER, yes?

    If so, maybe a sample spreadsheet would help.

  5. #5
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    I am confirming with CTRL + SHIFT + ENTER.
    The I understand the forumla will not work if there are cells containing blank values in any of the fields I am including into the forumla. I created a smaller demo table and forumla to try it out on and it worked perfect so I am assuming it is something in the data? Can you think of any other reason why it would not work for a data reason, obviously I have checked for blank values and also ensured all columns are formatted to the correct data types -date, number etc.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Count Unique based on date

    Normally you wouldn't use the part in red

    =COUNT(IF(FREQUENCY(IF('BackOrder Summary'!$A$2:$A$437=Summary!$A$9,MATCH('BackOrder Summary'!$C$2:$C$437,'BackOrder Summary'!$C$2:$C$437,0)),ROW('BackOrder Summary'!$A$2:$A$437)-ROW(Summary!$A$9)+1),))

    that would be

    =COUNT(IF(FREQUENCY(IF('BackOrder Summary'!$A$2:$A$437=Summary!$A$9,MATCH('BackOrder Summary'!$C$2:$C$437,'BackOrder Summary'!$C$2:$C$437,0)),ROW('BackOrder Summary'!$A$2:$A$437)-ROW('BackOrder Summary'!$A$2)+1),))

    but in this case that would only cause problems in the last few rows of your range and wouldn't account for a discrepancy of the size you mention......
    Audere est facere

  7. #7
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    I think it was a data issue because it seems to be working correctly now. Thanks for taking the time to check the forumla, I appreciate it greatly! what I dont appreciate is being supplied with inconsistent data!!! thanks again

    Dan

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    I didn't catch that, thanks DLL.

  9. #9
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Smile [SOLVED] Re: Count Unique based on date

    solved thanks!

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  11. #11
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    Actually - as a side query, related to this, if each of these unique orders have a quantity attached to the line - is there a way of summing this. I have tried amending the forumla to look at the quantity column and changing the function from a count to a sum but it results in 0. Any ideas?

    currently it appears as such...
    {=(SUM(IF(FREQUENCY(IF('BackOrder Summary'!$A$2:$A$437<Summary!$A$9,MATCH('BackOrder Summary'!$J$2:$J$437,'BackOrder Summary'!$J$2:$J$437,0)),ROW('BackOrder Summary'!$A$2:$A$437)-ROW(Summary!$A$9)+1),)))}

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    You need to add a summing range after that last comma..

    e.g.

    Please Login or Register  to view this content.
    where B2:B437 is the range to sum.
    Last edited by NBVC; 08-24-2011 at 06:45 PM.

  13. #13
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    what a guy!
    thank you so much. that is great work

  14. #14
    Registered User
    Join Date
    08-24-2011
    Location
    Yorkshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique based on date

    Another questions - has anyone got any idea how this formaula would be able to ignore blank cells? i am looking to change the above forumla to not specifically look at a range of data but a whole column at a time.

    cheers

  15. #15
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique based on date

    As long as the blanks you talk about are after the main data, then it would be more advisable to use dynamic named range, which automatically expands and contracts as you add or remove data from the main database.

    So, in Excel2007, go to the Backorder Summary sheet, and then go to Formulas tab and click Define Name in the Defined Names section.

    Enter a name like MyData and then refers to:


    Please Login or Register  to view this content.
    Click Ok

    Then use formula like:

    Please Login or Register  to view this content.
    Where the non-zero number in the INDEX() functions represents the column number of interest in the named range... so 1 is A, 10 is J and 2 is B (summing range).

+ 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