+ Reply to Thread
Results 1 to 7 of 7

finding first non-zero value in each row

  1. #1
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Question finding first non-zero value in each row

    I have some rows with numbers and strings, how can I find first non-zero value in each row?


    Example:

    0 2 0 0 0 ----> 2

    0 0 1 0 2 ----> 1

    0 0 ENG 2 0 ----> ENG


    Thanks in advance.
    Last edited by omid020; 01-12-2024 at 03:28 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,715

    Re: finding first non-zero value in each row

    Try:

    =LOOKUP(2,1/(A1:ZZ1<>0),A1:ZZ1)

    Adjust the range to suit, and copy down.

    Administrative Note:

    Is your forum profile showing the Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The three most recent Excel products are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: finding first non-zero value in each row

    Ali,

    doesnt that find the LAST non zero value in a row?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,715

    Re: finding first non-zero value in each row

    Yes - I misread the question!

    Waiting to see what version of Excel the OP has.

  5. #5
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: finding first non-zero value in each row

    Please try (works in Excel 2007 and newer):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If you don't have Excel 365, please confirm the formula with Ctrl+Shift+Enter

  6. #6
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: finding first non-zero value in each row

    Sorry for delay. both suggested functions work like a charm in excel 2010. Thanks!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,715

    Re: finding first non-zero value in each row

    Mine doesn't!

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered 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. Finding conditional drawdowns (10%, 20%) and finding number of days to recovery
    By Pranavgarg0497 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2022, 03:04 AM
  2. [SOLVED] Macro not finding finding selected characters in strings
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-12-2017, 01:47 AM
  3. Replies: 2
    Last Post: 06-25-2017, 10:16 AM
  4. Finding an adjacent value after finding a maximum value on another column
    By VanCricken in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-10-2016, 11:58 AM
  5. Finding Duplicates - Then finding delta
    By meppwc in forum Excel General
    Replies: 1
    Last Post: 09-30-2015, 04:10 PM
  6. Replies: 10
    Last Post: 12-17-2009, 02:00 AM
  7. Replies: 3
    Last Post: 03-02-2007, 07:13 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