+ Reply to Thread
Results 1 to 6 of 6

Selecting first negative number in a row and returning the associated column value

  1. #1
    Registered User
    Join Date
    02-04-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    18

    Selecting first negative number in a row and returning the associated column value

    I have row of dates and underneath those dates I have a row of numbers. The numbers count down. For example:

    Please Login or Register  to view this content.
    At the end of the row I want a cell to return the date that the row first started going negative at. In this example, it should display 10/31/2014 (for when it went to -60).
    Last edited by pdx-adm-trm01; 02-10-2014 at 01:01 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Selecting first negative number in a row and returning the associated column value

    Hi,

    One way with an array formula. i.e. enter with Ctrl-shift-enter. Assumes data is in A1:L2

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Selecting first negative number in a row and returning the associated column value

    Assuming your dates are in A1:L1, and values are in A2:L2, try this ARRAY formula:

    =INDEX(A1:L1,1,MIN(IF(A2:L2<0,A1:L1)))

    Remember, it is an array formula, so you must apply it by holding down Ctrl + Shift and pressing Enter... not just Enter.

    - Moo

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

    Re: Selecting first negative number in a row and returning the associated column value

    normally entered formula
    =index(a1:z1,match(true,index((a2:z2<0),0),0))
    "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

  5. #5
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Selecting first negative number in a row and returning the associated column value

    Quote Originally Posted by martindwilson View Post
    normally entered formula
    =index(a1:z1,match(true,index((a2:z2<0),0),0))
    I always love a non-Array version of a formula... somehow I always forget the Index within an Index method of doing so. Thanks, Martin!

    - Moo

  6. #6
    Registered User
    Join Date
    02-04-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Selecting first negative number in a row and returning the associated column value

    Quote Originally Posted by martindwilson View Post
    normally entered formula
    =index(a1:z1,match(true,index((a2:z2<0),0),0))
    Thank you, this worked perfectly.

+ 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. Replies: 5
    Last Post: 09-12-2012, 01:27 PM
  2. Replies: 12
    Last Post: 01-13-2011, 03:58 PM
  3. Lookup largest number in a column treating negative number as postive number
    By xWiZardx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 08:09 AM
  4. Selecting the smallest negative number
    By Coaster in forum Excel General
    Replies: 8
    Last Post: 09-04-2010, 12:28 PM
  5. [SOLVED] Negative Number column
    By go in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-27-2005, 09:20 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