+ Reply to Thread
Results 1 to 5 of 5

XLOOKUP Display next non-zero reading columsn from top down.

Hybrid View

  1. #1
    Registered User
    Join Date
    01-02-2023
    Location
    Melbourne, Australia
    MS-Off Ver
    365
    Posts
    6

    XLOOKUP Display next non-zero reading columsn from top down.

    Hi

    I have two columns that display numbers at random intervals of time and otherwise are left as blanks or zeroes (unsure of the correct terminology). When a number appears on one of the columns, I want my formulas to search the other column for the most recent number and the next number.

    The below formula is one that I got working, it tells me the most recent number because the second part of the array (B11), is the same row as the cell, and it returns the first value as I wanted it to.

    =LOOKUP(1000,IF($B$1:$B11<>0,$B$1:$B11))

    That method won't work when trying to find the next number, because I need excel to search from top to bottom and display the next number further down the column.

    Here's one example of an XLOOKUP I tried, I made many attempts but couldn't find anything which worked. The problem is that XLOOKUP doesn't find the next result, and evaluates the entire array instead, to find the best match.

    =XLOOKUP(10000,IF($B1:$B$36<>0,B1:$B$36),B1:$B$36,"nande",-1,1)

    When the numbers occur is random but if Column C returns 109, Column B will always be 108.5 or 109.5, because it's always -0.5 or +0.5. If Column B returns 108.5, the next Column B number will be 107.5, 108.5 or 109.5, -1, +0 or +1.

    Thus, it may be possible to have XLOOKUP search for a few exact numbers if that would solve the problem, though I'd prefer to just have XLOOKUP do what the LOOKUP is doing except with the top to bottom search function.

    I intend not to have these be used as columns, but to stick them into a formula that compares whether the most recent and next Column B numbers were the same or different whenever Column C returns a value.

    I don't have to use XLOOKUP, but I'd like to understand how to use XLOOKUP to do this assuming it's possible.

    Thanks for any help and please feel free to ask any clarifying questions if needed.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,176

    Re: XLOOKUP Display next non-zero reading columsn from top down.

    Try this

    =INDEX(B1:$B$36,MATCH(TRUE,B1:$B$36<>"",0))

  3. #3
    Registered User
    Join Date
    01-02-2023
    Location
    Melbourne, Australia
    MS-Off Ver
    365
    Posts
    6

    Re: XLOOKUP Display next non-zero reading columsn from top down.

    Thanks Phuocam, it worked perfectly!

    Can I ask, did you use index & match because it was the solution you thought of, or is it because XLOOKUP wouldn't have been able to do this?

    I'm happy to use your suggestion, but I'd like to know if XLOOKUP could've done this and that I wasn't using it correctly, or whether XLOOKUP just wasn't the tool for the job.

    Thanks Again.

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

    Re: XLOOKUP Display next non-zero reading columsn from top down.

    With XLOOKUP you can do the same:
    Formula: copy to clipboard
    =XLOOKUP(TRUE,B1:$B$36<>"",B1:B$36,"nande",0)

  5. #5
    Registered User
    Join Date
    01-02-2023
    Location
    Melbourne, Australia
    MS-Off Ver
    365
    Posts
    6

    Re: XLOOKUP Display next non-zero reading columsn from top down.

    Hey HansDouwe,

    That worked as well.

    I didn't think about using something like TRUE with exact match mode or using TRUE at all.

    Thanks!

+ 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] Display random title from Reading list for books I haven't read.
    By rose8693 in forum Excel General
    Replies: 1
    Last Post: 08-13-2019, 03:06 PM
  2. How to transpose data into different columsn via functions
    By dobracik in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 07-16-2016, 10:15 PM
  3. [SOLVED] Cheapest supplier 3 columsn , 2 I know
    By makinmomb in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-21-2014, 01:55 PM
  4. [SOLVED] Creating a Master Database with linked columsn
    By Cogito13 in forum Excel General
    Replies: 8
    Last Post: 07-01-2013, 02:44 PM
  5. Merging columsn / rows / sorting data
    By hawkeye12345 in forum Excel General
    Replies: 1
    Last Post: 05-25-2012, 02:30 AM
  6. AverageIF excluding matching columsn over a number
    By los318 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-01-2011, 05:02 PM
  7. Adding date and time from different columsn into one
    By venu_creative in forum Excel General
    Replies: 8
    Last Post: 05-13-2010, 05:15 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