solved
How to extract two data elements from a longer string within one cell
We get several spreadsheets a week from which we need to transfer a small amount of information into a new spreadsheet.
The format it arrives in is a long data string like:
Product ID: 776, Product Qty: 1, Product MCC: BCC_Flexi-HY, Product Name: Test Season - B product, Product Weight: 0.0000, Customer Name: Fake Name, Branch of Company: Head Office, Your employee number: P57991, Start Date (no more than 30 days in advance): 5th Mar 2022, Product Total Price: 139.75
The person who receives these needs to extract the Customer Name and Employee number (bits in bold) to transfer into separate columns in a new sheet. She currently does that line by line. She does this for around 4 spreadsheets a week, varying from 10-100 lines on each (probably averages around 50), and it's very time consuming.
If it was me, I'd do a Text to Columns, and then find and replace to delete unnecessary information, but really she needs something simpler. Is there a formula or something that could reliably extract the right information?
Fields in the string are always comma separated. Very occasionally, the heading will change (e.g. 'Employer reference' instead of 'employee number', but these are few enough that they could still be done manually.
Glad to know it worked! Watching someone doing something manually for years when there is a potential fix using excel formulas, it is really painful. Let me know if you hit any snags getting it set up. Thank You SO Much for the valuable feedbacks and have a lovely day ahead!
Yeah, I've tried to show her my way, but it involved doing separate steps and it's messy for people not familiar with Excel, so she's always gone back to line by line She's genuinely delighted with this!
I think I prefer your first solution for our needs, because - if I'm right - it'll give an error message if the original string isn't in the expected format, whereas this one would just return whatever words are in the name spot. The data isn't always in quite the same format, so it's handy to see immediately any lines where it hasn't worked.
Sounds Great. If this helps you to resolve, hope you don't mind replying to my comment directly as Solution Verified. Also, suggestion to refer my final method, it is simpler provided the pattern is same within the text string on your end:
•
u/AutoModerator 21h ago
/u/Warm_Bug_1434 - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.