+ Reply to Thread
Results 1 to 4 of 4

Counting consecutive numbers in excel

  1. #1
    Registered User
    Join Date
    10-17-2010
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    2

    Counting consecutive numbers in excel

    Here is my problem:

    I have a column of words, either "positive" or "negative" that corresponds to another column that let me know if a number was positive or negative. What I want to happen is to insert a new column to the right of this one to let me know how many days in a row it was positive or negative: It looks like this:

    Colum A Column B
    Positive 1
    Positive 2
    Negative 1
    Positive 1
    Positive 2
    Positive 3
    Positive 4
    Negative 1
    Positive 1
    Negative 2
    Negative 2


    The issue I am having is trying to get a formula that would tell me how many days in a row it was positive or negative. I do not want to have to enter 1 2 1 1 2 3 4 ...etc. So I need a formula that I can put in column B and be able to copy down the entire column for any additional day I decide to add in there.

    Thanks for you help!!!

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting consecutive numbers in excel

    see attached gives same result as your example
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    05-02-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    20

    Re: Counting consecutive numbers in excel

    Hello,

    can you help me in a problem in excel?

    In the range of A1:A18 have 18 numbers which can be both positive and negative (eg. 1.5, -1.3, 2, -2.3, etc...).
    If all positive numbers using the product can calculate the product of these numbers.

    =product(A1:A18) - results positive. This is OK.

    If use an odd number of negative numbers then I get a negative results. This is OK.

    If use an even number of negative numbers then i get a positive value. This is fine in math but i want to get a negative result in cell.

    If any negative number in range A1:A18 then I would like to get the product negatively.

    A1=2
    A2=2
    A3=2
    A4=2

    1) =product(A1:A4) = 16. OK

    A1=-2
    A2=2
    A3=2
    A4=2

    2) =product(A1:A4) = -16. OK

    A1=-2
    A2=-2
    A3=2
    A4=2

    3) =product(A1:A4) = 16. This is fine in Math but i need result -16.

    Thanks all.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Counting consecutive numbers in excel

    Welcome to the board, carduel.

    Please take a few minutes to read the forum rules, and then start your own thread.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ 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