+ Reply to Thread
Results 1 to 5 of 5

Countif formula required with various criteria

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    Halesowen, England
    MS-Off Ver
    Excel 2016
    Posts
    45

    Countif formula required with various criteria

    Hi there,

    What I need is a formula to count how many instances an order appears.

    Fairly straightforward? Yes, but I need the formula to 'not' count duplicate order numbers or orders that have a negative qty next to them.

    i.e
    the same order number may appear 4 times in the raw data list, but I need that to be counted as just 1 order.

    I have put the answers I am trying to find in the example to the right of the data.

    Appreciate any help you may provide.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,299

    Re: Countif formula required with various criteria

    Use this array formula, copied down:

    =SUM(IF(FREQUENCY(IF($C$2:$C$19=$E3,IF($B$2:$B$19>=0,$A$2:$A$19)),IF($C$2:$C$19=$E3,IF($B$2:$B$19>=0,$A$2:$A$19)))>0,1))

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,653

    Re: Countif formula required with various criteria

    Or also array formula (a bit different one):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    02-14-2014
    Location
    Halesowen, England
    MS-Off Ver
    Excel 2016
    Posts
    45

    Re: Countif formula required with various criteria

    Both solutions worked perfect.

    Thank you both

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,299

    Re: Countif formula required with various criteria

    Leelnich has just pointed out that part of my formula is redundant. Thanks!!

    =SUM(--(FREQUENCY(IF($C$2:$C$19=$E3,IF($B$2:$B$19>=0,$A$2:$A$19)),$A$2:$A$19)>0))

    is better. It's still an array formula, though.

+ 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] Formula required for criteria as cell reference
    By Yadavgiri in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-27-2017, 08:38 AM
  2. [SOLVED] Formula required to Calculate Week number based on Criteria
    By Yadavgiri in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-26-2016, 08:48 AM
  3. [SOLVED] COUNTIF or COUNT formula help required
    By MYEM1983 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-05-2014, 01:42 PM
  4. [SOLVED] Formula Required to Lookup and Match Multiple Criteria
    By The_Snook in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-06-2014, 10:59 AM
  5. [SOLVED] Excel formula required to sum values that fit within a certain criteria
    By dmcarthur212 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-20-2013, 09:16 AM
  6. Three criteria formula required
    By Killer17 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-27-2008, 01:19 AM

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