I have 2 tables as follows:
Table1:
Table1.png
Table2:
Table2.png
I want to match the asset number in brackets in Table2 to asset in Table1, to produce a third table:
Table3:
Table3.png
Any help highly appreciated!
Thank you.
Joseph
I have 2 tables as follows:
Table1:
Table1.png
Table2:
Table2.png
I want to match the asset number in brackets in Table2 to asset in Table1, to produce a third table:
Table3:
Table3.png
Any help highly appreciated!
Thank you.
Joseph
Do uou have O365 yet??
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
Hi Glenn, not in my office laptop. Though, can access via my hotmail account. Thank you.
That doesn't quite answer my Q. Whatr Excel Product do you want the solution to work for? Your profile shows TWO products... and you have access to O365. So, which is the earliest version you want any solution to work for? If that is ALWAYS the case, then amend your profile accordingly.
I found a solution for O365, but it is difficult (for me) to translate this to a solution for older versions.
Please try in O365:![]()
Please Login or Register to view this content.
Last edited by HansDouwe; 01-05-2024 at 10:25 AM.
Hi Glenn, above is my personal file, so it's okay if in 365. But for office work, I cannot use 365.
PQ solution is also welcome!
Thanks Hans, your solution is working very well!
For 2016,
D13 and copy down.
E13 and copy down.![]()
Please Login or Register to view this content.
F13 , copy down and across.![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Thank you, windknife. It's working fine! Any PQ solution?
Header for Table3 with just the number, i.e. no asset name would be fine with me. Thank you.
Thanks for the feedback and rep. Glad to have helped.
I also found a solution for Excel 2021 (everything in one go)
Please try in Excel 2021 or in O365:![]()
Please Login or Register to view this content.
2021 Formula: replace MID(f,g+1,99) with LEFT(f,g-2,99)Header for Table3 with just the number
365 Formula: replace TEXTAFTER(INDEX(Table1,c-2)," ") with TEXTBEFORE(INDEX(Table1,c-2),".")
Joseph
As requested, I did not rearrange columns and rows. This is can be done either in PQ or in Excel. But all aligns as shown in your expected solution. A bit of a convoluted PQ, however.
Here is a Power Query Solution.
Excel 2016 (Windows) 64 bit![]()
Please Login or Register to view this content.
D E F G H I J K 27No. Unit Chair Table Table Lamp Side Table Sofa Fan 281 1-2 x x 2910 12-1 x 3011 3-3 x 3112 33-3 x x x 322 2-2 x x x 333 23-1 x 344 17-2 x x x x 355 3-1 x x x 366 19-3 x 377 33-2 x x x 388 19-2 x x x 399 21-1 x
Sheet: Sheet1
Last edited by alansidman; 01-06-2024 at 12:55 PM.
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
Thank you Hans for your solutions in posts #12 and #13.
Thank you Alan for answering my PM. And thanks for the PQ solution, it works nicely! The code is very structured and I can understand perfectly.
.
Just one thing.. is it possible to maintain the sequence of the assets in Table1 in the final result?
Thanks for the nice question Joseph and rep again. It was fun and educational to make these formulas..
Last edited by HansDouwe; 01-06-2024 at 10:15 PM.
I think this is what you are looking for
![]()
Please Login or Register to view this content.
Hi Alan, thanks again. The reorder line does give me the correct result. But, is it possible to not hardcode it? The asset list in Table1 is expandable.
Joseph,
I am unsure of what you are referring. I don't recall hardcoding any fields.
Thanks for checking back, Alan.
This line is hard-coded:
PHP Code:
#"Reordered Columns" = Table.ReorderColumns(#"Pivoted Column",{"No.", "Unit", "Table", "Chair", "Sofa", "Fan", "Table Lamp", "Side Table"})
Alternatively is to not reorder the columns or to reorder them alphabetically which I have done in the latest Mcode. Those are the only options I can think of.
Excel 2016 (Windows) 64 bit![]()
Please Login or Register to view this content.
D E F G H I J K 27No. Unit Chair Fan Side Table Sofa Table Table Lamp 28 11-2 x x 29 22-2 x x x 30 323-1 x 31 417-2 x x x x 32 53-1 x x x 33 619-3 x 34 733-2 x x x 35 819-2 x x x 36 921-1 x 37 1012-1 x 38 113-3 x 39 1233-3 x x x
Sheet: Sheet1
EDIT: Had an after thought and that would be to keep the number of the Asset aligned with the Asset to keep it in the order in the table of Assets. Your thoughts?
Last edited by alansidman; 01-07-2024 at 06:04 PM.
I changed this code up a bit to keep the order of the columns in the same order as you have provided in the Asset Table. This will eliminate any "hard coding" or movement of columns
![]()
Please Login or Register to view this content.
Thank you, Alan! Perfect now! Here's a Rep for you!
Thanks Joseph for the Rep. If this solves your issue, please mark the thread as solved.
Oh ya, thanks for reminding Alan. Now marked solved.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks