+ Reply to Thread
Results 1 to 15 of 15

XLOOKUP from table where the looked up columns may move

  1. #1
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    XLOOKUP from table where the looked up columns may move

    Hi

    I am stuck trying to get an XLOOKUP formula to work when looking up from a table where the columns may change order.

    The table which has the data for the lookup has many rows and columns and is updated with copy and paste as values from a master version. The master version cannot be linked directly due to sensitive information. The master version may change at any time, moving columns around. This is creating havoc with my current XLOOKUP formula!

    I have attached a spreadsheet with an example of the problem I am trying to solve.

    Any help would be much appreciated to fix the XLOOKUP formula, or use another function which is better for this job!

    Many thanks

    Kev
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: XLOOKUP from table where the looked up columns may move

    Maybe use INDEX and MATCH, where the MATCH function locates the column by looking at the headings.

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: XLOOKUP from table where the looked up columns may move

    N4=XLOOKUP(L4,INDEX(Table1,,MATCH(L3,Table1[#Headers],0)),INDEX(Table1,,MATCH(M3,Table1[#Headers],0)))
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Many thanks CARACALLA


    Unfortunately when I copy and paste the data from the table in columns O to X into columns A to X, in order to replicate how the data is updated, the formula no longer works.

    I really need to the formula to continue to work after the data is updated.

    Any help is much appreciated

    Best Wishes

    Kev

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    Post a file AFTER the "update"
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  6. #6
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Thanks Glenn

    I have attached what happens when I copy and paste the data from columns O to X into columns A to J.

    The formula loses the reference for the headers.

    Best Wishes

    Kev
    Attached Files Attached Files
    Last edited by kevdas; 10-14-2023 at 11:03 AM.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    This should run it to ground...


    =INDEX(INDEX($1:$1048576,,MATCH($L$3,$1:$1,0)+4),MATCH($L$4,INDEX($1:$1048576,,MATCH($L$3,$1:$1,0)),0))
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Hi Glenn

    Many thanks but this didn't really fix it because I only want to look up from the table in the top left of the sheet.


    The other table (columns O to X) was only there to use as an example of the table I copy data from (which is actually in a different spreadsheet).

    BUT

    Combining your formula and the formula from CARACALLA, I think I have it sorted using:


    =XLOOKUP(L4,INDEX(A1:J8,,MATCH(L3,A1:J1,0)),INDEX(A1:J8,,MATCH(M3,A1:J1,0)))

    I attached the solution in case anyone else has this problem. The updated version has the example tables to copy and paste from moved to rows 24 onwards.

    Thank you all for your help!
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Many thanks Pete!

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    My formula will find the values wherever they are.
    Attached Files Attached Files

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    You're welcome. Thanks for letting us know that you got an answer.




    If that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  12. #12
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Hi Glenn

    In reality, the table in column O to X will not be there.

    If I delete that data, the formula no longer works - it doesn't get the info from the table in columns A to J.

    I have altered the spreadsheet so that the example tables to copy from are on a different sheet to the final table to be looked up.
    There are two example tables to copy across where the columns are in a different order

    Best Wishes

    Kev
    Attached Files Attached Files

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    You didn't say (clearly enough) that the column order varied from time to time.

    =INDEX(INDEX($1:$1048576,,MATCH($M$3,$1:$1,0)),MATCH($L$4,INDEX($1:$1048576,,MATCH($L$3,$1:$1,0)),0))
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    08-01-2011
    Location
    London, England
    MS-Off Ver
    Office 365 updated
    Posts
    13

    Re: XLOOKUP from table where the looked up columns may move

    Hi Glenn

    Sorry - I thought I was clear on this by stating that the columns may move in the title of this thread, and by stating 'The master version may change at any time, moving columns around' in my first post.

    Either way, many thanks for your help in getting to the solution.

    Best Wishes

    Kev

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: XLOOKUP from table where the looked up columns may move

    I thought moving meant moving the table from one place to another.

    Oh well.

+ 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] Xlookup in a Table
    By mstgier in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 05-17-2022, 06:14 PM
  2. [SOLVED] XLOOKUP to check 2 columns
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2021, 12:13 PM
  3. [SOLVED] Xlookup multiple columns
    By sunboy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2021, 11:45 AM
  4. [SOLVED] In Pivot table, same month columns to move in next to each other
    By Karnik in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 10-09-2017, 03:54 AM
  5. max/min values looked up in a pivot table
    By smulder1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-18-2016, 08:44 AM
  6. [SOLVED] select 3 columns of a table and move to the bottom even with spaces
    By stephme55 in forum Excel General
    Replies: 3
    Last Post: 01-25-2016, 05:08 PM
  7. [SOLVED] How to move numerous sets of data from columns to rows within a table?
    By Rob8489 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2012, 05:58 AM

Tags for this Thread

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