+ Reply to Thread
Results 1 to 9 of 9

Lookup a value and return column that has non-blank value

  1. #1
    Registered User
    Join Date
    07-15-2014
    Location
    South africa
    MS-Off Ver
    MS Office for Mac
    Posts
    7

    Lookup a value and return column that has non-blank value

    Hi everyone,

    I am looking for a formula that can lookup a value from a data table, then loop through multiple columns and return a column that has non-blank value.

    Please see attached for more information.

    Many thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Lookup a value and return column that has non-blank value

    L6 =IF(M6=0,"maintenance",INDEX($D$4:$H$4,MATCH(M6,OFFSET($D$5,MATCH(K6,$C$6:$C$19,0),0,1,5),0)))


    m6 =SUMPRODUCT(($C$6:$C$19=K6)*($D$6:$H$19))

    if your data is an accurate representation of reality, eg never 2 numbers on the same row

  3. #3
    Registered User
    Join Date
    07-15-2014
    Location
    South africa
    MS-Off Ver
    MS Office for Mac
    Posts
    7

    Re: Lookup a value and return column that has non-blank value

    Worked like Magic. Thank you so much davsth

  4. #4
    Registered User
    Join Date
    07-15-2014
    Location
    South africa
    MS-Off Ver
    MS Office for Mac
    Posts
    7

    Re: Lookup a value and return column that has non-blank value

    I have realised that its possible to have more than 2 numbers on two rows. Is it possible to get the results as attached?
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,568

    Re: Lookup a value and return column that has non-blank value

    I don't see any difference between the data in the two files.
    Based on the narrative in post #4 it seems that there should there be rows of data in the file attached to that post that have two numbers?
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Lookup a value and return column that has non-blank value

    I agree with the above, no desired answer and no data showing data on 2 lines. Please attach a representative file

  7. #7
    Registered User
    Join Date
    07-15-2014
    Location
    South africa
    MS-Off Ver
    MS Office for Mac
    Posts
    7

    Re: Lookup a value and return column that has non-blank value

    Yes, The only difference is that the data has rows with two number, so I need help in how I can address that. The first answer I got assumed that there will be only one value per row, which I later realised it is not the case. I have highlighted the cells in red where cells have more than one number. We can assume that row can have up-to (maximum) two numbers.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Lookup a value and return column that has non-blank value

    If the values can be split into additional columns and there can never be 3 values
    l6 =IFERROR(INDEX($D$4:$H$4,MATCH(TRUE,INDEX(($D6:$H6>0),0),0)),"Maintenance")
    m6 =IFERROR(INDEX(D6:H6,MATCH(TRUE,INDEX(($D6:$H6>0),0),0)),0)
    n6 =IF(COUNTIF(D6:H6,">0")>1, LOOKUP(2,1/($D6:$H6>0),$D$4:$H$4),"")
    o6 =IF(COUNTIF(D6:H6,">0")>1, LOOKUP(2,1/($D6:$H6>0),D6:H6),"")

  9. #9
    Registered User
    Join Date
    07-15-2014
    Location
    South africa
    MS-Off Ver
    MS Office for Mac
    Posts
    7

    Re: Lookup a value and return column that has non-blank value

    Thank you so much davsth. These formulas work 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. [SOLVED] V lookup - return value in another column if cell within v-lookup column is blank
    By Jacks18928 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2019, 06:46 AM
  2. Lookup a blank cell in a Lookup table and return a figure.
    By jonnops in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-20-2014, 07:33 AM
  3. Replies: 4
    Last Post: 03-13-2013, 12:38 PM
  4. Replies: 0
    Last Post: 01-21-2013, 10:31 AM
  5. Replies: 1
    Last Post: 11-07-2012, 01:57 PM
  6. [SOLVED] Return blank if lookup result is 0 or NA?
    By Fursmanm in forum Excel General
    Replies: 2
    Last Post: 07-30-2012, 08:56 AM
  7. Lookup to return blank if data not available
    By keith6292 in forum Excel General
    Replies: 3
    Last Post: 12-14-2009, 02:37 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