Peter Nguyen
Peter Nguyen

Reputation: 101

Excel Pulling Text within Cells

So I have a cell that contain this text string. I was wondering if I can pull the text between from and upon. So it captures AAA (being varying degree of length)

life insurance policy #111 111 111 for the amount of $500,000.00 from AAA upon the life of xxx

So far I only managed this: =MID(STP_Data!D71,FIND("from",STP_Data!D71), 42)

But if the text length changes it wouldn't capture it. Also how would I not capture from within my formula. Since my currently formula will include 'from' when it is pulled. Thanks guys!

Upvotes: 0

Views: 60

Answers (1)

BruceWayne
BruceWayne

Reputation: 23283

How does this work?

=Trim(SUBSTITUTE(MID(A1,SEARCH("from",A1),SEARCH("upon",A1)-SEARCH("from",A1)),"from",""))

Edit: Added TRIM() per Scott's suggestion.

Upvotes: 1

Related Questions