Full text from the custom format of the cell

theteacher9999

New Member
Joined
Jun 8, 2020
Messages
12
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hello,

I'm struggling with the following issue.

In C2 I have this formula because I want to get the last word from A in C column (it shoould be 'Last' instead of '63636'):
VBA Code:
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))
The problem is that A2 cell has a strange custom format, as shown in the picture below:

one.png



Is there any way to get a full text of A2? I know I can do it by copying it to Text Box and paste it in the same field but I will have more cells formatted this way. (Note that in this particular example A3 doesn't have any custom format and what I got it in C3 looks good).

Ultimately, I plan to create columns B and C with VBA but the problem is the strange format in column A.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
One way would be to do it in VBA with a UDF
VBA Code:
'UDF
Function LastWord2(MyCell As Range) As String
    Dim S As String, SA
    
    Application.Volatile
    SA = Split(MyCell.Text, " ")
    LastWord2 = SA(UBound(SA))
End Function

tmp1.xlsm
ABCD
1originalamountlastwordlastword2
266777.00 GBP Last6677766777Last
Sheet5
Cell Formulas
RangeFormula
B2B2=A2
C2C2=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))
D2D2=lastword2(A2)
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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