+ Reply to Thread
Results 1 to 9 of 9

Avoid counting duplicate dates

  1. #1
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Avoid counting duplicate dates

    Hello friends,

    I'm tring to write a formula to count the working days in a chosen month and in the whole year based on a list with non-working days in that year.
    Everything works fine but I have a problem. If someone enters the same date more than once the foumula counts that entry too. How could I modify the formula in E2 and I2 respectively to avoid counting duplicates.

    Thank you !
    Attached Files Attached Files
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Avoid counting duplicate dates

    select your range L18:L42
    Data -> Data Validation ->Allow: Custom, Formula: =COUNTIF(L18:L42,L18)>1
    ok
    try input the same date

    but it works only if user type date manually. If he/she paste copied date it will won't work.
    Last edited by sandy666; 02-15-2017 at 10:32 AM. Reason: "but" added

  3. #3
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Avoid counting duplicate dates

    Thank you sandy!
    Your solution goes around my question and prevents the duplicates.
    Is there a way for counting the duplicates only once?
    Thanks again!

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Avoid counting duplicate dates

    you mean
    05/01/2017
    05/01/2017 - counted
    05/01/2017 - not counted?

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Avoid counting duplicate dates

    If the date is twice or more times in the list it should be counted as 1.
    so
    01.05.2017 - count (first time in the list)
    15.08.2017
    01.05.2017 - already in the list - do not count
    26.12.2017
    01.05.2017 - already in the list - do not count

    Here we have 3 distinctive days.

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Avoid counting duplicate dates

    But this is quite contrary to the topic
    but if you wish you can count but not in Data Validation which is not necessary

    Count dup only once: =SUMPRODUCT((L2:L26<>"")/COUNTIF(L2:L26,L2:L26&""))

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: Avoid counting duplicate dates

    Try this ...

    D3: =NETWORKDAYS(DATE(B2,C2,1),DATE(B2,C2+1,0))

    E3: =D3-F3

    F3: =NETWORKDAYS(DATE(B2,C2,1),DATE(B2,C2+1,0),L2:L26)

    H3: =NETWORKDAYS(DATE(B2,C2,1),DATE(B2,13,0))

    I3: =H3-J3

    J3: =NETWORKDAYS(DATE(B2,C2,1),DATE(B2,13,0),L2:L26)
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Avoid counting duplicate dates

    thank you Phuocam !
    thank you sandy!
    Both solutions work great.
    I'm gonna mark the topic closed as it hits the goal.
    Unfortunately I was expectig a result matrics that have 1's for the first apearance of the date and 0's for the following ones.
    But you've been very helpful!
    Have fun!

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Avoid counting duplicate dates

    Glad to help and thanks for the feedback

+ 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] Project Dates - avoid blocked dates
    By pauldaddyadams in forum Excel General
    Replies: 12
    Last Post: 01-15-2016, 06:42 AM
  2. [SOLVED] Avoid double counting of same value
    By Karen57 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-02-2015, 09:23 AM
  3. [SOLVED] Set up avoid duplicate problem
    By aleman_li in forum Excel General
    Replies: 2
    Last Post: 04-23-2015, 10:12 AM
  4. Counting number of unique dates per month in a list of duplicate dates
    By Rackle83 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-22-2013, 10:15 AM
  5. Excel 2007 : How to avoid duplicate entry
    By suhail in forum Excel General
    Replies: 4
    Last Post: 10-24-2010, 10:17 PM
  6. Avoid Duplicate Names
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 01:48 PM
  7. Avoid Duplicate Records
    By Amarjeet Singh in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-22-2009, 09:05 PM

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