Trim Function

kipper19

Board Regular
Joined
Apr 12, 2014
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Hi all, I have the following data in Column A, I would to trim the data after the wording R1 or R2 or R3 etc etc and show it in column E, formula shown does work if the data in Colum A shows R1, how can i incorporate to show the trimmed data if the wording is not R1 and maybe R5

trim.jpg
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I didn't test my previous answer well enough.
I would suggest that all the formula that you have suggested are a bit 'risky' in that if subsequently any rows are added at the top of the sheet, they would return incorrect results.

@kipper19
Here is another suggestion that you could try in your 2019 version.
If you are still not sure that you have a satisfactory answer from the various suggestions offered, please provide a larger set (say 8-10 rows) of varied sample data and the expected results for that data, preferably with XL2BB so that helpers can easily copy to test with that data.

23 10 22.xlsm
ABCDEFGHIJKLMNOP
1R1R2R3R4R5R6R7R8R9R10R11R12
210-Jun-23 1300m Hwavy 8 R11 RTG 66+ $2RTG 66+ $2
3Hwavy 8 R2 RTG 67RTG 67
410-Jun-23 1300m Hwavy 8 R3 RTG 68+ $100RTG 68+ $100
5 
6abc 
7abc R12 defdef
kipper19
Cell Formulas
RangeFormula
B2:B7B2=IFNA(REPLACE(A2,1,FIND(" ",A2,LOOKUP(9^9,FIND(E$1:P$1,A2))),""),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 1
How about
Excel Formula:
=TRIM(TEXTAFTER(A3,"R"&SEQUENCE(,9)))
 
Upvote 0
1235.xlsm
ABCD
1R1R2R3
210-Jube-23 1300m Hwavy 8 R1 RTG66+RTG66+  
310-Jube-23 1300m Hwavy 8 R2 RTG66+ RTG66+ 
410-Jube-23 1300m Hwavy 8 R3 RTG66+  RTG66+
Sheet4
Cell Formulas
RangeFormula
B2:D4B2=IFERROR(TRIM(MID($A2, SEARCH(B$1, $A2) + 2, LEN($A2))),"")

1235.xlsm
ABCD
1R1R2R3
210-Jube-23 1300m Hwavy 8 R1 RTG66+RTG66+  
310-Jube-23 1300m Hwavy 8 R2 RTG66+ RTG66+ 
410-Jube-23 1300m Hwavy 8 R3 RTG66+  RTG66+
Sheet4
Cell Formulas
RangeFormula
B2:D4B2=IFERROR(TRIM(MID($A2, SEARCH(B$1, $A2) + 2, LEN($A2))),"")

Muhammed, thanks for the reply, that would work but i need all of the results to show only in Column B
 
Upvote 0
How about
Excel Formula:
=TRIM(TEXTAFTER(A3,"R"&SEQUENCE(,9)))
Fluff, appreciate your time but my excel does not support the TextAfter function, using Office and Home 2019
 
Upvote 0
Apologies, Im using this on my laptop with a different system, I should have stipulated which version in the original post
 
Upvote 0
Then this would be an alternative to using the textsplit:
Excel Formula:
=CONCAT(IFERROR(MID(A2,FIND("R"&ROW($1:$99),A2)+LEN(ROW($1:$99))+2,LEN(A2)),""))
 
Upvote 0

Forum statistics

Threads
1,215,691
Messages
6,126,219
Members
449,303
Latest member
grantrob

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