+ Reply to Thread
Results 1 to 8 of 8

Counting horizontal and vertical cells based on two conditions

  1. #1
    Registered User
    Join Date
    12-15-2015
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    4

    Counting horizontal and vertical cells based on two conditions

    Attachment 435403

    I am trying to create a formula that counts a certain value from multiple columns, but only for certain rows based on another condition. In the example data in the picture, i'd want to count the occurrences of a certain task i.e Telephone from columns C to G, but for a particular staff type i.e. Managers. I can't think of a way to apply the count to only the rows matching manager.

    Thanks for any help everyone!

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Counting horizontal and vertical cells based on two conditions

    If it's only five columns across, then probably the simplest construction would be to five COUNTIF functions.

    Please Login or Register  to view this content.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: Counting horizontal and vertical cells based on two conditions

    Hi and welcome to the forum

    Pictures are of little value. Honestly, no one wants to re-type your data to try and solve your issue. Additionally, we would only be guessing at how your data was structured, ie. formulas, formatting, etc.

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" of what you wish the output to be.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    Re: Counting horizontal and vertical cells based on two conditions

    Assuming your staff grades are in B1 to B10 and your duties are in C1 to J10, use this:

    =SUMPRODUCT((C1:J10="telephone")*(B1:B10="Manager"))

    Normally I wouldn't bother mocking up anyone's sheet for them, but I'm bored today.....
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 12-15-2015 at 10:40 AM.
    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

  5. #5
    Registered User
    Join Date
    12-15-2015
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    4

    Re: Counting horizontal and vertical cells based on two conditions

    Hi,

    Really really appreciate that, sorry I didn't attach the file originally - i'll use the new guy excuse just the once...

    Glad someone was bored anyway. The actual data set (this is just a sample) is many more columns wider so I couldn't have used individual countif statements.

    Much appreciated anyway. I have pointlessly attached the file now for practice!

    Thanks.
    Attached Files Attached Files

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

    Re: Counting horizontal and vertical cells based on two conditions

    Great! I'm glad to have helped! If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

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

    Re: Counting horizontal and vertical cells based on two conditions

    I just opened your attachment. For the final formula, use this:

    =SUMPRODUCT(($C$1:$G$10=C$14)*($B$1:$B$10=$B15))

  8. #8
    Registered User
    Join Date
    12-15-2015
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    4

    Re: Counting horizontal and vertical cells based on two conditions

    Thanks so much Glenn, I've applied the formula fully to my actual data now and it works like a charm!

    I've been using Excel for years and this had me stumped.

    A very nice welcome to the Forum - cheers!

+ 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. Counting horizontal and vertical cells based on two conditions
    By ChrisP80 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-15-2015, 10:10 AM
  2. Vertical to Horizontal Data Content w/ DeDuped Special Conditions 2
    By guypier in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-09-2015, 11:23 AM
  3. [SOLVED] Lookup with THREE conditions: one vertical, two horizontal
    By splendidus in forum Excel General
    Replies: 7
    Last Post: 08-05-2014, 01:11 PM
  4. [SOLVED] Formula copies down & across using table with two vertical conditions & one horizontal
    By David Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-13-2013, 04:33 PM
  5. Macro: Vertical to Horizontal data, specific conditions
    By yannwester4 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2012, 08:49 PM
  6. Vertical to Horizontal Data Special Conditions
    By guypier in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-05-2011, 03:30 PM
  7. Replies: 2
    Last Post: 04-06-2011, 10:08 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