+ Reply to Thread
Results 1 to 5 of 5

Countifs & OR function

  1. #1
    Registered User
    Join Date
    06-14-2017
    Location
    Atlanta,
    MS-Off Ver
    Microsoft Excel 2016 MSO
    Posts
    55

    Countifs & OR function

    Hi guys,

    Please refer to the attached workbook for reference. I need to create a countifs function with an OR component, but can't figure out how. Its probably a sum(countifs(or array function or something like that.

    I would like to count:

    Id = 1, 2, 3, 4 (the total number of times this ID appears. For this function I reference a cell is another list such as B4=1, B5=2, etc...), and
    BW = (1)PY1, and
    CH = (2)Not terminated, and
    FJ = (2)Not terminated, and
    DJ OR GL = (1)Yes

    For example: The correct number for ID 1 should be 3 because ID one appears three times with BW=(1)PY1, CH=(2)Not terminated, FJ(2)Not terminated, and although DJ are no's it turned into three yes's in GL. I hope that makes sense

    Its the last part, the DJ or GL that is messing me up. This is a partial list for reference purposes only, and not the full list.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Countifs & OR function

    Perhaps
    =SUMPRODUCT((A2:A30=1)*(B2:B30="(1)PY1")*(C2:C30="(2)Not terminated")*(D2:D30="(2)Not terminated")*(E2:F30="(1)Yes"))

    although if both E and F could be yes
    =SUMPRODUCT((A2:A30=1)*(B2:B30="(1)PY1")*(C2:C30="(2)Not terminated")*(D2:D30="(2)Not terminated")*(EE230="(1)Yes"))+SUMPRODUCT((A2:A30=1)*(B2:B30="(1)PY1")*(C2:C30="(2)Not terminated")*(D2:D30="(2)Not terminated")*(E2:E30<>"(1)Yes")*(F2:F30="(1)Yes"))
    Last edited by davsth; 03-28-2018 at 03:40 AM.

  3. #3
    Registered User
    Join Date
    06-14-2017
    Location
    Atlanta,
    MS-Off Ver
    Microsoft Excel 2016 MSO
    Posts
    55

    Re: Countifs & OR function

    Hi Davsth,

    That actually wont work. The columns E and F are not actually right next to each other in the database. The column headings in the attachment (e.g., DJ and GL) refer to the actual column headings in the database. So based on your formula it would be (DJ:GL"(1)Yes") and that would pick up a lot of the corresponding noise in between columns DJ and GL. Sorry for setting up the demo file improperly.

  4. #4
    Registered User
    Join Date
    06-14-2017
    Location
    Atlanta,
    MS-Off Ver
    Microsoft Excel 2016 MSO
    Posts
    55

    Re: Countifs & OR function

    HI guys,

    none of those functions worked. But I did finally think of a work around. I will code a cheater column to say true or false if either column DJ or FL ='s yes. Then I can use a regular countifs function.

    Thanks!

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Countifs & OR function

    sumproduct uses a range, so a1:a1000000 would work but a:A would not. Glad you got a solution

    you can use countifs for column DJ as yes in one count if + a similar count if with DJ as No and GL as yes, as you only want to count GL if you havent counted that row in DJ


    countifs(A:A,1,B:B,"(1)PY1"),C:C,"(2)Not terminated"),D:D,"(2)Not terminated"),DJ:dJ,"(1)Yes") +countifs(a:A,1,B:B,"(1)PY1",C:C,"(2)Not terminated"),D:D="(2)Not terminated",DJ:dJ,"<>(1)Yes",GL:GL, "(1)Yes")

+ 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. adding a Frequency function to a CountIFS function
    By Plucky_ in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-12-2017, 08:13 PM
  2. COUNTIF/COUNTIFS function + nested user-defined function
    By shamjamali in forum Excel General
    Replies: 1
    Last Post: 05-12-2015, 09:12 PM
  3. Use COUNTIFS function on results of DATEVALUE function?
    By Si902 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-16-2015, 08:13 PM
  4. Countifs function in vba
    By Sugisenthil in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-27-2015, 04:56 AM
  5. [SOLVED] Help with the =COUNTIFS function
    By jbunk in forum Excel General
    Replies: 3
    Last Post: 05-18-2012, 04:14 PM
  6. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  7. Countifs function
    By jerrywoods in forum Excel General
    Replies: 1
    Last Post: 11-07-2008, 05:14 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