Hey everyone! I’m stuck on a spreadsheet problem. I need to pull out all the stuff inside parentheses from a cell and put them in another cell with commas between. Here’s what I mean:
Cell A1 has:
coolpic.png (/stuff/pics/cool.png), awesomepic.png (/stuff/pics/awesome.png)
I want cell B1 to show:
/stuff/pics/cool.png, /stuff/pics/awesome.png
I figured out how to get one value with this formula:
MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)
But it only grabs the first set of parentheses. I need it to work for all of them, and the number of parentheses might change in each row.
Any ideas on how to make this work? Thanks for your help!
hey spinninggalaxy, i’ve got a hacky solution that might work. try this formula:
=TEXTJOIN(“, “, TRUE, IFERROR(MID(SUBSTITUTE(A1, “)”, “)”+CHAR(1)), SEARCH(”(”+CHAR(1), SUBSTITUTE(A1, “)”, “)”+CHAR(1))&CHAR(1))+1, SEARCH(“)”+CHAR(1), SUBSTITUTE(A1, “)”, “)”+CHAR(1), SEARCH(“(”+CHAR(1), SUBSTITUTE(A1, “)”, “)”+CHAR(1))&CHAR(1))+1)-SEARCH(“(”+CHAR(1), SUBSTITUTE(A1, “)”, “)”+CHAR(1))&CHAR(1))-1), “”))
it’s messy but gets the job done without vba. lmk if u need help!
I’ve tackled a similar problem before, and I found that using a combination of regular expressions and custom functions worked well. In Excel, you’d need to create a VBA function to handle this. For Airtable, you might be able to use a scripting app or third-party integration.
If you’re open to alternatives, Google Sheets has a built-in REGEXEXTRACT function that could solve this elegantly. The formula would look something like:
=JOIN(", ", REGEXEXTRACT(A1, “(([^)]+))”))
This extracts all content within parentheses and joins them with commas. It’s more flexible than trying to use MID and FIND for multiple occurrences.
Remember to adjust the formula syntax if you’re using a different spreadsheet application. Hope this helps point you in the right direction!
I’ve run into this exact issue before, and I can tell you it’s a bit tricky with just built-in Excel functions. What worked for me was creating a custom VBA function. It’s not too complicated, even if you’re not a coding wizard.
To give you an idea, I opened the VBA editor (Alt+F11), inserted a new module, and pasted in a function that uses RegEx to extract all parenthetical content. The function loops through all matches and concatenates them, allowing you to call it from any cell by passing your input cell as the argument.
It’s a bit more work upfront, but it’s far more flexible than chaining multiple MID and FIND functions. Once it’s set up, you can even reuse it across your entire workbook or save it for future projects. Let me know if you need details on the exact code.