+ Reply to Thread
Results 1 to 7 of 7

Go to right thru a range and skip all blank cells, return value of first non-blank in rang

  1. #1
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Go to right thru a range and skip all blank cells, return value of first non-blank in rang

    hi is there a formula that can do this?

    What I need is to go through a row (from say AA1:GA1) and skip all the cells that are blank (="") and return the value of the first non-blank cell in the range AA1:GA1.

    This will be nested within an IF(and(or(...))) statement.

    Thanks very much!

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    Confirm with ctrl+shift+enter (not just enter)

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

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    Try

    =INDEX(AA1:GA1,MATCH(TRUE,INDEX(AA1:GA1<>"",0),0))

  4. #4
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    This should find the first non-blank value in your range:
    =INDEX(AA$1:GA$1,MATCH(TRUE,INDEX((AA1:GA1<>0),0),0))

    Edit: this isn't an array formula - just enter as normal
    Last edited by Aardigspook; 09-16-2015 at 01:54 PM. Reason: Clarify not an array formula
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    Montreal, Qc, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    Hi,

    i used row 1 columns "A" to "C" in my example, but you'll get the point.


    =IF(A1<>"",A1,IF(B1<>"",B1,IF(C1<>"",C1,"All blank")))


    hope that helps
    If I helped, Don't forget to add to my reputation

  6. #6
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    Quote Originally Posted by Aardigspook View Post
    This should find the first non-blank value in your range:
    =INDEX(AA$1:GA$1,MATCH(TRUE,INDEX((AA1:GA1<>0),0),0))

    Edit: this isn't an array formula - just enter as normal
    Thanks, this is the one that works best for me. However, in an attempt to make this a bit more refined I would like to add a condition to it via an if/and/or combination:

    =IF(OR(F952="Liability",F952="Motor",AND(Y952=0)),INDEX(BJ952:GG952,MATCH(TRUE,INDEX((BJ952:GG962<>0),0),0)),Y952)

    however, any time "Liability" or "motor" is indeed found the formula spits out an "#N/A" error. Other than that it works fine. I am certain it is a problem with my login in the IF argument.

    In summary:

    If F1 = "Motor" or "Liability" AND Y1 = 0 THEN go to right thru range from BJ1:GG1 and return the value in the first non-blank cell.

    Thanks very much!
    Last edited by mysticmoron109; 09-16-2015 at 03:08 PM.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Go to right thru a range and skip all blank cells, return value of first non-blank in

    =IF(AND(Y1=0, OR(F1="Motor", F1= "Liability")), INDEX(BJ1:GG1,MATCH(TRUE,INDEX((BJ1:GG1<>0),0),0)),Y1)

    The OR is inside the AND
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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. [SOLVED] Return non-blank Cells from a Range
    By Jonathan78 in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 10-16-2017, 09:35 AM
  2. [SOLVED] Return value cannot skip blank cell
    By namialus in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-19-2014, 12:12 PM
  3. Concatenate, Skip Blanks and Carriage Return only after non-blank
    By GTide in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-14-2014, 05:08 PM
  4. [SOLVED] return non-blank cells from a range
    By douge1238 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-25-2013, 03:06 PM
  5. [SOLVED] Return all non-blank cells from a range
    By Mecha_Trueno in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-30-2013, 11:38 AM
  6. Replies: 3
    Last Post: 11-22-2007, 07:53 AM
  7. [SOLVED] How do I skip blank cells when copying over a range of cells?
    By tawells in forum Excel General
    Replies: 2
    Last Post: 06-08-2005, 11:05 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