+ Reply to Thread
Results 1 to 8 of 8

Pulling nth non zero value in a row?

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Pulling nth non zero value in a row?

    I have a row of values and I need to pull the second non-zero value on the same sheet, which in the example below is 500:

    A B C D E F G H
    Index/Match(200) NEWFORMULAHERE 0 0 0 200 0 500 300 0

    I use an Index/Match formula to grab the first non-zero value (200). However next to my index/match formula for the first non-zero, I need to pull the next non zero.

    How can I write a formula to grab the 2nd non zero, and the 3rd non zero, etc. I'm not well versed with array formulas, so I may need some interpretation/explanation of any formulas posted.

    I originally found this post: http://www.excelforum.com/excel-form...-in-a-row.html but I could not get the formula provided to work.

    Can anyone help? Thanks for your time.
    Last edited by spd87; 02-21-2014 at 04:20 PM.

  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: Pulling nth non zero value in a row?

    you could try
    =IFERROR(INDEX($B$1:$T$1,SMALL((INDEX(($B$1:$T$1<>0)*(COLUMN($B$1:$T$1)-1),0)),SUMPRODUCT(--($B$1:$T$1=0))+COLUMNS($A$1:A1))),"") filled across or
    =IFERROR(INDEX($B$1:$T$1,SMALL((INDEX(($B$1:$T$1<>0)*(COLUMN($B$1:$T$1)-1),0)),SUMPRODUCT(--($B$1:$T$1=0))+rows($A$1:A1))),"") filled down
    "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
    02-21-2014
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Pulling nth non zero value in a row?

    Using the below formula is returning me a "0". Do you see anything wrong with it? I did hit CTRL+Shift+Enter. I've tried to use both formulas, but I'm not getting the 500 pulled in.

    =IFERROR(INDEX($B$1:$Z$1,SMALL((INDEX(($B$1:$Z$1<>0)*(COLUMN($B$1:$Z$1)-1),0)),SUMPRODUCT(--($B$1:$Z$1=0))+COLUMNS($A$1:A1))),"")

    Thank you

  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: Pulling nth non zero value in a row?

    works for me
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-21-2014
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Pulling nth non zero value in a row?

    Martin,

    I'm having trouble putting mine into your format, please see attached. Thanks for all of your help. spd87 v2.xlsx

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

    Re: Pulling nth non zero value in a row?

    there you go i changed it slightly
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-21-2014
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Pulling nth non zero value in a row?

    Thanks Martin, this is perfect.

  8. #8
    Registered User
    Join Date
    09-20-2019
    Location
    Cape Town, South Africa
    MS-Off Ver
    365
    Posts
    15

    Re: Pulling nth non zero value in a row?

    Many thanks martindwilson! After trawling through numerous other sites with complex solutions, having your attachment helped me. Really, thank 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. Pulling a Specific Cell when Pulling a Tabel from Web Based Data
    By Zallen89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2013, 05:39 PM
  2. Help Looking Up and Pulling Value
    By daw382 in forum Excel General
    Replies: 6
    Last Post: 08-25-2011, 07:39 PM
  3. Pulling the whole Row
    By cjohnsen in forum Excel General
    Replies: 1
    Last Post: 10-09-2006, 11:06 PM
  4. Pulling data from web
    By famdamly in forum Excel General
    Replies: 3
    Last Post: 02-26-2006, 02:20 PM
  5. Pulling out every nth value
    By Anauna in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-07-2005, 05:06 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