Forum Discussion
Adding the integers before a certain string in a single cell
I would like to seek help for the following problem: I wish to add the integers before certain strings in a single cell. See detailed image below:
I think a VBA Macro in which adds all integers before the string "A" as well as before the string "B" can do this but I'm not quite sure what is the correct syntax to perform the operation.
Thanks in advance!
5 Replies
Hi Kristian
Is it just one cell that you will be evaluation and a single character string (A-Z)?
If so then I'd suggest Power Query as an alternative to VBA (built in to Excel 2016, or available to download for Excel 2010 & 2013)
Is there a reason that the data has to be entered in this way rather than 2 separate columns?
- Kristian Lawrence CaringalCopper Contributor
Hi Wyn,
Thank you for your response.
Yes there is a reason in which data has to be entered this way. I will have to evaluate multiple cells in this format.
Hi Kristian
Here's a version that can handle multiple rows.
I've added 2 options (one uses a slightly newer feature which is split to rows)
It does rely on the fact that the string is always 1 character