+ Reply to Thread
Results 1 to 7 of 7

INDEX & MATCH not working through a power query

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    INDEX & MATCH not working through a power query

    So I have a workbook comprising of two worksheets; 'Index' and 'PriceSheet'. The table found within 'PriceSheet' comes from a Get Data from workbook Power Query (See image '1').

    1.JPG

    The table of info found in 'PriceSheet' is shown in image 2.

    2.JPG

    Both files are stored on Office365 SharePoint, though the workbook is opened and edited locally. The query connection works perfectly fine and refreshes when required.

    Data types for 'PriceSheet' are as follows; Col A1:A13 = General aligned to right side // Row A1:L1 = General aligned to right side // Cells B2:L13 = Number and aligned to the right. All columns have had 'Text to Columns' performed on them.

    So as you can see the formula should result in the value found at the intersection of both 'JPA5' and '250', which in this case would be '1.52', but instead i get the #N/A

    I have tested this formula in steps:
    First i just wrote an index formula and it worked '=INDEX(PriceSheet!A1:A13,3)'
    Then i wrote an index formula that came back with a cells contents based on a position '=INDEX(PriceSheet!A1:L13,3,5)' and it worked.
    Next i wrote a formula that used the match function for the rows only assigning a column number to it '=INDEX(PriceSheet!A1:L13,MATCH(B4,PriceSheet!A1:A13,0),5)' and again this worked fine.
    However, the moment i add the Match function for the columns it fails.

    Any thoughts and advice greatly appreciated as i am going out of my mind here!!

  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
    80,647

    Re: INDEX & MATCH not working through a power query

    Your second match is missing the match type operator (0 or 1) at the end.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    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
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: INDEX & MATCH not working through a power query

    Hi AliGW,

    Thank you for your reply, I have tried the (0 or 1) at the end with no joy, but deliberately leave it out to allow the freedom of being able to input a 'Qty' that isn't listed in the table. For example if somebody input 255 as the Qty, it would normally return the 250 rate/price and saves me having to insert columns for every quantity.

    Finally, the reason i did not include an actual workbook example is in case the fact that the 'PriceSheet' worksheet was the result of a power query was the reason for my issue, as i am unsure whether or not this is affecting things??

  4. #4
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: INDEX & MATCH not working through a power query

    Sample workbook attached
    Attached Files Attached Files

  5. #5
    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
    80,647

    Re: INDEX & MATCH not working through a power query

    The headers in your PQ table do not match - they are text, not numbers. Also your ranges are not defined correctly. Try this:

    =INDEX(PriceSheet!B2:L13,MATCH(B4,PriceSheet!A2:A13,0),MATCH(B6,--(PriceSheet!B1:L1),0))

  6. #6
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: INDEX & MATCH not working through a power query

    Whoa, what magic is this???? MATCH(B6,--(PriceSheet!B1:L1),0))

    What are you doing here? It works though Is this a genuine resolve or a work around?

    many thanks for your time, it is much appreciated

  7. #7
    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
    80,647

    Re: INDEX & MATCH not working through a power query

    You have two options:

    1. Ensure that the query returns real numbers to the column headers - probably the trickier option unless you demote the header row.
    2. Use my suggestion: the -- simply forces Excel to see those text values as numbers.

    NOTE: Getting the ranges right in the INDEX MATCH MATCH is essential - that's a correction, NOT a workaround!!!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Power Query - can I make my query working faster?
    By afgi in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 03-13-2020, 03:41 AM
  2. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  3. power query subquery not working
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-18-2019, 07:25 PM
  4. VBA Recording Power Query not working
    By justinwb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2019, 08:55 AM
  5. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  6. Power Query - Parameter not working
    By vibajajo64 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2018, 01:08 AM
  7. code to refresh power query not working ..
    By Hassan1977 in forum Excel General
    Replies: 0
    Last Post: 08-31-2016, 12:31 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