Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have dabbled quite a bit in Excel and VBA. I now try to learn about Power Query. I've come to realise that PowerQuery is mostly for data management/relations, whereas VBA should really only be used for cosmetic changes (as it takes a lot of processing power, correct me if I'm wrong). I'm starting to get a grasp of the concept, but I had a question:
Can PowerQuery replace index/match?
I have here two tables with the exact same information (using index/match). I didn't add anything new, other than different IDs. Would I be able to write a name in the secondary table and get the results from the primary table without the need for index/match?
I have attached screenshots of my excel file (I can't upload the actual file) to help me with this (I'm using it to learn more about power query).
I'm not interested (yet) in learning about power pivot though, as I see no need for pivot tables in my life.
Hi, @martinqb
Yes, Power Query can replace the need for Index/Match in many scenarios, and it can be a more efficient and user-friendly way to manage data and perform lookups. Power Query is designed specifically for data transformation and manipulation tasks, including merging, filtering, and transforming data from multiple sources.
In your case, where you have two tables with the same information and want to perform lookups based on a common field (e.g., "Name"), Power Query can easily handle this. You can use Power Query to merge the two tables based on the "Name" column, effectively replicating the functionality of Index/Match.
Here's a general outline of the steps you would take in Power Query to replace Index/Match:
Load both tables into Power Query: Import both the "Primary Table" and the "Secondary Table" into Power Query.
Merge queries: In Power Query, you can use the "Merge Queries" option to merge the two tables based on the "Name" column. This will combine the data from both tables into a single table.
Expand the results: After merging the queries, you may need to expand the results column, so you can see the values from the "Primary Table" that match the "Name" in the "Secondary Table."
Transform data as needed: If required, you can further transform the data, such as renaming columns or removing unnecessary columns.
Load the results: Once the data is transformed, you can load the results back into Excel or create a new worksheet with the updated data.
Power Query's approach is more streamlined and generally more efficient compared to using Index/Match formulas, especially when dealing with larger datasets. It also offers more flexibility in terms of data manipulation and data cleaning.
Remember that Power Query doesn't change the underlying data; it only creates a new query with the merged and transformed data. So, if your data in the "Primary Table" changes, you can easily refresh the Power Query to update the results.
GPT generated detailed reply.
To learn more about using Power Query for data manipulation, see
https://learn.microsoft.com/en-us/power-query/
Proud to be a Super User!
I can also use ChatGPT:
------------------------------------------
Yes, you are correct in your understanding of the roles of Power Query and VBA in Excel.
Power Query (also known as Get & Transform in Excel) is primarily used for data preparation, transformation, and data management tasks. It provides a powerful and user-friendly interface to clean, reshape, and combine data from multiple sources. Power Query is highly efficient in handling large datasets and can perform various data operations quickly and with ease.
Regarding your question, yes, Power Query can replace the need for INDEX/MATCH in many cases. INDEX/MATCH is a popular Excel formula combination used to look up values in a table based on specific criteria. However, Power Query offers the "Merge" functionality, which can perform similar tasks more efficiently.
In Power Query, you can merge tables based on one or more columns, just like using INDEX/MATCH with multiple criteria. The process is called "Table Merge" or "Join" in Power Query. By using Merge, you can avoid complex array formulas and improve the readability and maintainability of your data transformations.
Here's a high-level example of how Power Query can replace INDEX/MATCH:
Let's say you have two tables: Table1 and Table2, and you want to pull a value from Table2 into Table1 based on a common key (e.g., ID).
Using INDEX/MATCH:
In Excel, you would write a formula like this in a cell of Table1:
=INDEX(Table2[DesiredColumn], MATCH([@ID], Table2[ID], 0))
Using Power Query:
By following these steps, you can achieve the same result as INDEX/MATCH but in a more organized and efficient manner.
Power Query's strength lies in handling complex data relationships, joining tables, and applying transformations, making it a powerful tool for data management tasks. However, it's essential to know that both INDEX/MATCH and Power Query have their places in Excel, and there might be scenarios where one is more suitable than the other based on the specific requirements of your task.
------------------------------------------
PeteGPT
Proud to be a Datanaut!
Yeah, perfect time saver. 😂
Proud to be a Super User!
Proud to be a Datanaut!
MS made GPT public to utilize it. If you know the answer and provide it a context and askt it to write details answer. It will write it for you. Why write details answer when you can generate?
I do not see any problem here. I am not denying the fact that I used GPT to generate detailed answer. I thought PQ could solve the problem and it's possible in PQ so I asked GPT to provide details.
Why is this even an issue, I am not sure. If anyone asked me if I wrote it directly and I replied that I did then it would have been unethical.
In community we help people the way we can.
I thought of not writing details just write short summary of my thoughts and asked to write in details. I do not see an issue here.
Hope I made my intentions clear.
Again, I am not denying the fact that I used GPT.
Proud to be a GPT user.
Proud to be a Super User!
Understood, but I think you should be up-front in your answer if using an AI response. Maybe prefix your answer with "From ChatGPT:" or similar.
I'm sure you wouldn't take a painting done by someone else to an art exhibition and put your own name on it, then expect everyone to be okay with "if you asked me if I painted it I would have told you I didn't" - same principle applies here.
Pete
Proud to be a Datanaut!
Edited and added to the reply.
Proud to be a Super User!
Cool. Although it does feel as though you've written the artists' name really small on the side of the frame here and kept your name on the big label.
Put the credit up-front, something like this:
Hi @personAskingQuestion,
From ChatGPT:
------------------------------------------------------------
Yes, Power Query can replace the need for Ind....
hewgfurgiugruvrdauhrea
------------------------------------------------------------
To learn more about using Power Query for data manipulation, see...
<LINK>
I don't want to go on, but I think this is a really important discussion to have.
We could very feasibly get into a position where people are just copying questions into ChatGPT and posting the answers without ever understanding if they're even correct, let alone whether they're actually the most suitable solution for the overall problem. Literal answers to bad questions can cause even more problems in the long-run than answers that flat-out don't work.
Pete
Proud to be a Datanaut!
This is really a scene here. I made it bold. Bold words literally catches eye first.
This is a debate really. I have agreed that yes, I used Gpt to generate detailed answer. Because I felt like this could be done using PQ. I made it very clear. I put summary answer and asked to generate detailed answer.
But you sir, literally are not happy and dragging it. I accepted it edited it. Made bold so that it catches eye first.
People answers different questions every time everyones answer is not correct. So, if I am wrong in this solution to think that PQ can do it then I am wrong. Whoever asking question will be accept the right solution I will know my mistake.
This is a community where you can seek help or can help people. Right?
Again I made my intentions clear and accepted the terms.
Why dragging so long, I am not sure of.
People can either use GPT to save time or waste their time. It's up to individual. It's public, anyone can use it.
I usually write short answers but I personally do like elaborated answer so I used GPT. What's wrong with that I do not know. You mocked it first then dragged it then I proudly accepted that I did and edited my answer.
But then again you have a problem.
I am not debating anymore sir. I accepted my terms, I rectified it.
But that does not make you happy then what else can I do, I do not know of.
Thanks
Proud to be a Super User!
Fair enough. Have a nice day.
Pete
Proud to be a Datanaut!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
61 | |
40 | |
39 | |
28 | |
16 |