How can i removed carriage keep last two line ?

Ks1102

Well-known Member
Joined
Jan 8, 2008
Messages
689
Dear experts

Do any way can i just only keeps the last two line in cells ?

Sample

20231214
20231215
20231215
20231217
20231217
20231217
20231218
20231218
20231218


To
20231218
20231218

your help highly appreciate
Thanks
 
Last edited by a moderator:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Reminder: Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Remove non necessady newline to keeps last two text in cell
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.

Two further points
  • I suggest that you update your forum profile (click your user name at the top right of the forum, then ‘Account details’) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

  • If posting a table as you did, do not enclose it in vba code tags. I have removed those for you this time. Better still, instead of posting a table like that, I suggest that you investigate XL2BB for providing sample data & expected results to make it easier for helpers to understand just what you have & where it is and also what you want & where it is to be. Helpers can also then easily copy your sample data for testing.
 
Upvote 0
.. as the best solution often varies by version.
For example, if you are using MS365, you can do it like this

23 12 19.xlsm
AB
120231214 20231215 20231215 20231217 20231217 20231217 20231218 20231218 2023121820231218 20231218
Last 2 lines
Cell Formulas
RangeFormula
B1B1=TEXTAFTER(A1,CHAR(10),-2)
 
Upvote 0
You're welcome. :)
What about in return you do what was suggested in my first bullet point above? ;)
 
Upvote 0
If the numbers separated by the carriage returns are always 8 digits long (as indicated by your example), then this simple formula would work...

=RIGHT(A1,17)
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,031
Members
449,092
Latest member
ikke

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