+ Reply to Thread
Results 1 to 10 of 10

Need help with Countifs that has vertical/horizontal criteria

  1. #1
    Registered User
    Join Date
    05-11-2018
    Location
    Washington, DC
    MS-Off Ver
    Office 2013
    Posts
    5

    Need help with Countifs that has vertical/horizontal criteria

    Hi,

    I'd like to do a countif function that returns the number of filled cells for a given sector in columns D, E, and F based on "value" or "policy". For instance, Media has two "value" cells whereas filled telecom only has one. Similarly, Media has one "policy" cell while Telecom has 0. In other words, I'm trying to do a lookup of a sector then do a countif with the horizontal criteria in row 2. An obvious issue is that the array Excel is looking for isn't contiguous with the vertical lookup, and I tried Index/match but that only returns one value...


    Sectors A B C D E F
    Value Policy Value
    Media 11 33 33 33 33 33
    Telecom 33 10 33 33
    Automotive 33 33 16 33 33


    Any help would be very much appreciated!
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Need help with Countifs that has vertical/horizontal criteria

    Hi, welcome to the forum

    Seeing as how the count is row-based, I dont see how any "vertical" entries would affect anything?

    If you just want to count how many "Values", then maybe just
    =COUNT(E3,G3)
    copied down
    The *Policy* would be a simple
    =COUNT(F3)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Need help with Countifs that has vertical/horizontal criteria

    Try this:

    =COUNTIFS($E3:$G3,">"&0,$E$2:$G$2,E$2)

    Copy across and down.

  4. #4
    Registered User
    Join Date
    05-11-2018
    Location
    Washington, DC
    MS-Off Ver
    Office 2013
    Posts
    5

    Re: Need help with Countifs that has vertical/horizontal criteria

    Estevaoba, how can that be combined with a vlookup or index/match to find a given Sector then see which “values” contain a value based on that sector?

  5. #5
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Need help with Countifs that has vertical/horizontal criteria

    Maybe this:

    =COUNTIFS(OFFSET($E$2:$G$2,MATCH("oil",$A$3:$A$9,0),0),">"&0,$E$2:$G$2,E$2)

    And you'll probably want to replace "oil" with a cell reference with data validation.

  6. #6
    Registered User
    Join Date
    05-11-2018
    Location
    Washington, DC
    MS-Off Ver
    Office 2013
    Posts
    5

    Re: Need help with Countifs that has vertical/horizontal criteria

    Estevaoba, that works perfectly!! Thanks a bunch

  7. #7
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Need help with Countifs that has vertical/horizontal criteria

    Glad to help!

  8. #8
    Registered User
    Join Date
    05-11-2018
    Location
    Washington, DC
    MS-Off Ver
    Office 2013
    Posts
    5

    Re: Need help with Countifs that has vertical/horizontal criteria

    Is there any way to do this without the offset function? It seems to be having problems when I copy it down the sheet to look for different sectors...

  9. #9
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Need help with Countifs that has vertical/horizontal criteria

    The formula in post #5 with OFFSET function is to find values for only one given sector, as requested in your post #4.
    Maybe if you post an example table with a few more rows to illustrate this problem, it will help us find a better approach.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Need help with Countifs that has vertical/horizontal criteria

    Does it have to be COUNTIF?

    With multiple instances of sector 'Value' SUMPRODUCT seems a more appropriate choice.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

+ 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. Sumproduct with criteria horizontal and vertical and > than
    By krunk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-09-2017, 11:37 AM
  2. Replies: 5
    Last Post: 10-03-2016, 03:39 AM
  3. CountIFs horizontal & vertical
    By TicklyTigger in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-26-2015, 03:39 PM
  4. Sum with multiple criteria Horizontal and Vertical
    By freqzz in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-26-2015, 04:39 AM
  5. Sum Multiple Criteria horizontal and vertical
    By baronk in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-16-2015, 07:55 AM
  6. [SOLVED] 3 criteria for horizontal and vertical matching
    By mator in forum Excel General
    Replies: 5
    Last Post: 12-24-2014, 07:19 AM
  7. [SOLVED] Lookup with vertical and horizontal criteria
    By busygurl in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-23-2014, 12:03 AM

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