Hi to all of you
At work my boss has challenged me to extract a code from a string in a cell.
The code is like 4 characters (can be letters and numbers)-5 numbers-5 numbers-year (2 numbers)
Example: AB42-12345-54615-25. Letters can be upper and/ or lower case.
In most cases the code has text and or numbers before and after - and always parted with a space on either side.
Example - "this is a test AB42-12345-54615-25 sold august 30. 2025"
Can any of you help me - in Power Query or otherwise to extract the code to a new column ?
In this example it would be - "AB42-12345-54615-25"
At work the file has 100.000 plus rows, so it will save me a lot of time.
Thank you
Erik
Must you do this in PQ?
Quite easy to do it in Excel. Have a look at the attached. Not very difficult to replicate this in PQ as well. Find the location of the first "-", minus 4 and then extract the next 19 characters.
Thanks a lot Riny - you are a life saver.
This task is not a one time thing, and in my experience a Power Query solution is less vulnerable to others using Excel - adding columns, rows or lacking skills using formulas.
But your solution is the one I will be using - Thank you
Erik
Glad I could help. As mentioned before, it's not difficult in PQ either. So, if you prefer using PQ, please see the attached file.
Thanks again Riny
I really appreciate your help.
Erik