+ Reply to Thread
Results 1 to 7 of 7

For a given range of cells B5:T5 count the number of cells containing x

  1. #1
    Registered User
    Join Date
    10-13-2018
    Location
    Arizona
    MS-Off Ver
    Office Professional Plus - Version 1809
    Posts
    8

    For a given range of cells B5:T5 count the number of cells containing x

    Having trouble getting the correct answer.

    There are four rows containing the following data in the range of B5:T5.

    x x - - x x - - - - - - - -

    - - x - - x x - - - x - - -

    This is what I've got in column V5 =COUNTIF(B5:T18,"x")
    This is what I've got in column V7 =COUNTIF(B7:T20,"x")

    The following is the result I'm getting.

    x x - - x x - - - - - - - - 8

    - - x - - x x - - - x - - - 4

    The 8 should only be 4. What am I doing wrong?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: For a given range of cells B5:T5 count the number of cells containing x

    Welcome to the forum!

    I don't understand why you are using several rows in your arrays instead of just one.

    Attach the workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-13-2018
    Location
    Arizona
    MS-Off Ver
    Office Professional Plus - Version 1809
    Posts
    8

    Re: For a given range of cells B5:T5 count the number of cells containing x

    I will actually have several rows containing data. I just showed the first few. I just need to total the number of x's in each row.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: For a given range of cells B5:T5 count the number of cells containing x

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    10-13-2018
    Location
    Arizona
    MS-Off Ver
    Office Professional Plus - Version 1809
    Posts
    8

    Re: For a given range of cells B5:T5 count the number of cells containing x

    I think I've attached my workbook.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: For a given range of cells B5:T5 count the number of cells containing x

    If you just want the total for each row try
    =COUNTIF(B5:T5,"x")

  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,150

    Re: For a given range of cells B5:T5 count the number of cells containing x

    In V5,

    =COUNTIF(B5:S5,"x")

    copied down.
    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

+ 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] Count number of cells in range since last number greater than zero
    By whitfieldcraig in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-18-2015, 06:38 AM
  2. Count the number of yellow cells within a range
    By singerbatfink in forum Excel General
    Replies: 5
    Last Post: 03-21-2014, 04:06 AM
  3. [SOLVED] Trim Range of Cells FIRST then Count the number of blank cells
    By Jim28 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-13-2013, 04:08 AM
  4. [SOLVED] Count the number of cells in a row that contain the MAX value in column range
    By Baseley10 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-10-2013, 07:22 AM
  5. Count number of cells between range
    By jrdawson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-01-2008, 02:02 PM
  6. Replies: 3
    Last Post: 06-05-2006, 02:35 PM
  7. Count number of cells in a range with amount > 0
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-13-2005, 07:01 PM

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