+ Reply to Thread
Results 1 to 6 of 6

PowerQuery index match prioritized criteria from 2 columns

  1. #1
    Forum Contributor
    Join Date
    04-30-2010
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    215

    PowerQuery index match prioritized criteria from 2 columns

    Hello all

    Could someone please tell me how I can create an index/match operation in Power Query, where it first looks up in one column, and if it finds a match it returns that, and if not it looks in another column. If it is blank in the first column and there is a match in second column, it should return the match from second column, not the blank.

    Like this where it should add a new column where it first look in FirstFruit, and then in SecondFruit:
    NewColumn.png

    I tried with the Merge options, but that does not seem to do as I thought it would.

    Any help will be highly appreciated

    Best regards
    Imbizile
    Attached Files Attached Files
    Last edited by Imbizile; 06-28-2020 at 10:36 AM. Reason: Change title

  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
    79,369

    Re: PowerQuery

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    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 Contributor
    Join Date
    04-30-2010
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    215

    Re: PowerQuery index match prioritized criteria from 2 columns

    Yes, sorry about that - made a more specific title now.

  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
    79,369

    Re: PowerQuery index match prioritized criteria from 2 columns

    What you appear to want is very easy.

    M Code:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-30-2010
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    215

    Re: PowerQuery index match prioritized criteria from 2 columns

    Yes, that was what I was after, and you are right, that does indeed seem quite easy, but still not familiar with M code syntax.

    But thank you very much AliGW

  6. #6
    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
    79,369

    Re: PowerQuery index match prioritized criteria from 2 columns

    No worries!

    It is all done with steps in the UI - these generate the M Code. Step through them using the cog to inspect their settings and you'll soon pick it up.

    I should perhaps add that if - then - else is case-sensitive and always needs to be lower case.
    Last edited by AliGW; 06-28-2020 at 01:13 PM.

+ 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. PowerQuery
    By wherdzik in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-08-2020, 03:03 PM
  2. PowerQuery in Excel: Use an Excel table to populate SQL table in PowerQuery
    By joeyslaptop in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2019, 02:33 PM
  3. PowerQuery Many 2 Many Relationships
    By rabbit_post in forum Excel General
    Replies: 1
    Last Post: 02-01-2018, 05:17 PM
  4. Unpivot with PowerQuery possible?
    By nobodyukno in forum Excel General
    Replies: 3
    Last Post: 08-23-2017, 03:34 PM
  5. VBA vs PowerQuery
    By Trachr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2017, 11:50 PM
  6. PowerQuery and VBA
    By Trachr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2017, 12:10 AM
  7. Help with powerquery.
    By stephme55 in forum Excel General
    Replies: 0
    Last Post: 09-01-2016, 07:31 PM

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