Thursday, September 20, 2018

yogi_Pull Parts of Strings From Cells B2:B Into Cells E2:E

Google Spreadsheet   Post  #2514

Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     Sep-20-2018
REGEX wizz? ArrayFormula to strip unnecessary text at the start and end of a cell's value?
I need hep with an ArrayFormula to be used in Google Sheets. I have tried several formulas but have not had any luck getting it quite right.  

I am using a google sheet to compile data from daily workout emails I receive. I then pull data from these cells to populate an RSS feed. I want to strip some things out of a cell to clean up the data that is pulled into my RSS feed.  

Looking at B2 in the "Sample" tab, I have turned the text red that I'd like to match. The text in the cell will always follow this format with the URLs preceding that bit of text "Posted by Dan DeLomba..." I am assuming I could match on "Posted by" then remove everything preceding the word "Posted"?

Towards the bottom of B2 is the second part to be cleaned up. Again, I have turned the text red. In this case, I'd like to match "The Post" then remove "The Post" and everything following.  This would leave the middle bit of text to be pushed into my RSS feed. 

I have created a sample sheet with 2 tabs.  The Sample tab is laid out like my actual sheet.  I have a second tab with some notes.  If anyone would be able to help me, that would be great!  Here is the link to the sample sheet.

Thanks!



Note:  User Lance Jacobs (NYC)  helped with this formula in a previous post :

=Arrayformula(Trim(IF(B2:B="",,Replace(RegexReplace(B2:B,"(^.+\n+.+\n+)",""),Find("The post",RegexReplace(B2:B,"(^.+\n+.+\n+)","")),10000,))))

but it wasn't quite right as it worked for row 2 but missed some bits in the next 2 rows.  He asked that I repost.  

No comments:

Post a Comment