+ Reply to Thread
Results 1 to 7 of 7

count up to the next blank cell

  1. #1
    Registered User
    Join Date
    09-28-2007
    Posts
    14

    count up to the next blank cell

    I have a long list of items within a column. I need to count nonblank cells starting from a certain cell, i.e. C1, all the way down but only up until the next blank cell appears.

    Example

    C
    1 xxx
    2 xxx
    3 xxx
    4 xxx
    5
    6 xxx
    7 xxx
    8
    9 xxx


    The result of doing that sort of counting here, starting in C1, should be 4.

    Is there a way to do this?

    thanks

    PS: Another way of looking at this, I guess, would be to count contiguous cells. Easier?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Does this do what you need?

    Please Login or Register  to view this content.
    where C1:C9 is the whole range

    and D1 contains a number representing the position number within the range you want to start with, so if you put 1 to represent C1, in D1, your result should be 4.

    Note: Formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER... you will see { } brackets appear around the formula.
    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.

  3. #3
    Registered User
    Join Date
    09-28-2007
    Posts
    14
    It has not worked, although it could easily be because I did something wrong, given that i am unfamiliar with your formula and therefore I don't understand it.

    Let me give you the real values.

    The column I want to check goes from H8 downwards, lets say H5000.

    Something else. In my Excel, for some reason I have to type ";" instead of ",".

    So, this is what I have:

    =MATCH(TRUE;(INDEX($H$8:$H$5000;1):$H$5000="")0)

    And it gives me an error message.

    It might have something to do with the NOTE you included at the end, because I also didn't understand that.

    Sorry for my lack of knowledge.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    It looks like a semicolon missing before final 0?

    =MATCH(TRUE;(INDEX($H$8:$H$5000;1):$H$5000="");0)

    after you type or paste this formula in the cell, hold the CTRL key and the SHIFT key down at the same time and then press ENTER.

    You will see curly brackets like these { } appear around the formula....

    Now you should have a numeric result? Yes?

  5. #5
    Registered User
    Join Date
    09-28-2007
    Posts
    14
    Impressive!

    It would be nice to understand exactly how you did it, because it is a function I would like to use in the future.

    What do the brackets mean?

    At any rate, if you don't have time to explain it, I must still send a big THANK YOU your way.

    Anxo from Spain

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    The curly brackets tell Excel that this is a special Array formula... here is more on Array formulas that can explain better than I can:

    http://www.cpearson.com/excel/ArrayFormulas.aspx

    This formula:

    =MATCH(TRUE;(INDEX($H$8:$H$5000;1):$H$5000="");0)

    The INDEX($H$8:$H$5000;1) part just finds the cell reference indicated by the position within the array...i.e. position 1.... note: if it is always going to be position 1 (or H8), then you don't need the Index() part at all... you can just have
    =MATCH(TRUE;$H$8:$H$5000="";0)

    The H8:H5000="" part creates an array of TRUEs and FALSEs depending on if the condition is true or not....

    Then the MATCH(TRUE()) looks for the first TRUE in that array and returns the position with the entire array.

    If you select the cell with the formula and go to Tools|Formula Auditing|Evaluate Formula you can follow the evaluation of the formula by hitting Evaluate for each step. Then you will see how the result is obtained.

    Hope this helps.
    Last edited by NBVC; 01-16-2008 at 01:30 PM.

  7. #7
    Registered User
    Join Date
    09-28-2007
    Posts
    14

    thanks

    NBVC.

    I came upon this thread and I just realized I forgot to thank you for your wonderful explanation.

    Gracias.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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