Collect data after IF statement

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
567
Office Version
  1. 365
Platform
  1. Windows
I have this data starting in A1. I need to copy the text after the "xx" but not every line with start with "xx". Need formula to take text after "xx" if there, if not just need the text.

xx ABCDEFGHI trying to get ABCDEFGHI
JKLMNOPQR trying to get JKLMNOPQR
xx 12345678 trying to get 12345678
STUVWXYZ trying to get STUVWXYZ

Thanks,
James
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Excel Formula:
=TEXTAFTER(A1,"xx ",,,,A1)
 
Upvote 1
Maybe something like this
VBA Code:
 =IFERROR(TEXTAFTER(A1,"xx "),A1)

Fluff's answer above is a much better option.
 
Upvote 0
Upvote 0
Fluff's answer is the better one. If there could be more than one space after the "xx" then.
=TRIM(TEXTAFTER(A1,"xx",,,,A1))
 
Upvote 0

Forum statistics

Threads
1,215,489
Messages
6,125,093
Members
449,205
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top