+ Reply to Thread
Results 1 to 13 of 13

Counting cells in a row that are less than 0

  1. #1
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    Counting cells in a row that are less than 0

    I need to count the largest string of cells that contains negative numbers in consecutive cells. See attached file. I hard coded column P.
    Attached Files Attached Files
    Last edited by Scorpvin; 09-09-2008 at 02:54 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    No attachment?
    Martin

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Counting cells in a row that are less than 0

    Using your posted workbook, this ARRAY FORMULA (committed with
    CTRL+SHIFT+ENTER, instead of just ENTER) seems to work:

    Please Login or Register  to view this content.
    Copy Q1 and paste into Q2 and down as far as you need.

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    Thanks Ron but I have another

    It worked! Thank you!
    Same sample, new problem.
    If column A2 is negative I need to count the consecutive negative cells from A2 on. The result for Q2 is 4. For Q1 it would be 0 because A1 is positive.

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Counting cells in a row that are less than 0

    Perhaps the same ARRAY FORMULA with a small tweak at the beginning....

    Please Login or Register  to view this content.
    Copy Q1 and paste into Q2 and down as far as you need.

    Does that help?

  6. #6
    Registered User
    Join Date
    09-29-2005
    Posts
    74
    Thanks Ron. You're awesome! Have a blessed day!

  7. #7
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    If A1 is negative need to count how many consecutive

    If A1 is negative I need to count how many cells including are negative consecutive cells including A1. See attached.
    Attached Files Attached Files

  8. #8
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Count consecutive negative cells in a row, including Col_1

    Maybe this....regular formula:
    Please Login or Register  to view this content.
    Does that work for you?

  9. #9
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    Did not work for row 3

    Worked for row 1 and row 2. Unsuccessful for row 3.
    Attached Files Attached Files

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe =IF(A1 >= 0, 0, IF(AND(A1:O1 < 0), COUNT(A1:O1), MATCH(TRUE, A1:O1 > 0, 0) - 1) )

  11. #11
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    Unhappy It did not work

    Still need some help.

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Perhaps:

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  13. #13
    Registered User
    Join Date
    09-29-2005
    Posts
    74

    Smile Problem Solved

    Thanks for all your help!

+ 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 individual coloured cells that are merged.
    By JohnSan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-06-2008, 01:11 PM
  2. Counting conditionally formatted cells
    By Nigel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-27-2008, 04:00 PM
  3. counting cells with data without counting duplicates
    By labettis in forum Excel General
    Replies: 2
    Last Post: 11-05-2007, 12:10 PM
  4. Counting - based on part of a cells contents
    By Paul Sheppard in forum Excel General
    Replies: 2
    Last Post: 09-17-2007, 11:35 AM
  5. Searching for and counting blank cells
    By guerilla in forum Excel General
    Replies: 1
    Last Post: 12-08-2006, 04:40 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