Count if two criteria match while ignoring duplicates

10,266

If you just want to count the different order numbers (in column B) that are complete (column A) try this

=SUM(IF(FREQUENCY(IF(A$2:A$100="Complete",MATCH(B$2:B$100,B$2:B$100,0)),ROW(B$2:B$100)-ROW(B$2)+1),1))

confirmed with CTRL+SHIFT+ENTER

To add another condition, e.g. assuming status in A and Store Id in B as before but with Sales Reps in column C you can use this version

=SUM(IF(FREQUENCY(IF(A$2:A$100="Complete",IF(C$2:C$100="Rep1",MATCH(B$2:B$100,B$2:B$100,0))),ROW(B$2:B$100)-ROW(B$2)+1),1))

of course you can use cells to store the criteria if you wish

Share:
10,266

Related videos on Youtube

Tom
Author by

Tom

Updated on September 18, 2022

Comments

  • Tom
    Tom over 1 year

    I have a simple Sheet with 2 cells that I need to countif 2 conditions match and treat duplicates as 1.

    Column A    Column B
    Male        closed
    Female      invalid #
    Male        exception
    Male        closed
    Male        closed
    Female      new
    

    I would like a formula that counts Male closed and return 1 result (ignoring duplicates)

    • soandos
      soandos about 12 years
      @SivaCharan It may help to look at the preview when you edit. There was an extra tab character that was throwing things off.
    • soandos
      soandos about 12 years
      Do you want the number of males, or something else about them?
    • Siva Charan
      Siva Charan about 12 years
      thanks @soandos for the update. I will take care next time, while updating...
    • Tom
      Tom about 12 years
      2 conditions need to be meet like male + closed (2 columns) however only whant to count that conditions 1 time rather then 1000 times that appears
    • Tom
      Tom about 12 years
      basic would be if male 1 male 1 male 2 male 3 male 1 in columns looking to count "male 1 search should only return 1 count"
    • Siva Charan
      Siva Charan about 12 years
      @Tom: here am bit confused. Can you tell whats your expected output?
  • Tom
    Tom about 12 years
    ok its a little more complicated I guess
  • Siva Charan
    Siva Charan about 12 years
    @Tom: so you need same output with formulas.. or something else
  • Tom
    Tom about 12 years
    this set of results should return 6 count because some of the results repeat thank you 941000106879 complete 941000106879 complete 941000106879 complete 941000107445 complete 941000107445 complete 941000107445 complete 941000107445 complete 941000107446 complete 941000107447 complete 941000107451 complete 941000107451 complete 941000107451 complete 941000107451 complete 941000107451 complete 941000107456 complete 941000107456 complete 941000107456 complete 941000107456 complete
  • Tom
    Tom about 12 years
    thank you! the formula I have now counts them all giving a result of 18 - because some have duplicate ID's I would like a formula that returns a result of 6 thus eliminating multiple order locations 18 orders 6 locations
  • Tom
    Tom about 12 years
    thank you this works great! can I add a 3rd value to key off like sales code+sales rep+status (counting code only once like before ignoring dupes) so keying off 3 column fields Store ID, Sales rep, Status, ignoring dupes in store ID
  • barry houdini
    barry houdini about 12 years
    I edited my answer to include another condition...