ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pasting data following the last " " in a cell (https://www.excelbanter.com/excel-programming/367418-pasting-data-following-last-cell.html)

Jim Jackson

Pasting data following the last " " in a cell
 
I have a column which contains data separated by " " in two or more
locations within each cell. I need to paste the farthest right data into
another cell.

Example: Names Places Cities etc.

I have searched the Posts her for an idea but nothing gets the desired
result. I have even tried replacing " " with " " but there still are two
or more of these.

Any ideas would be greatly appreciated.

--
Best wishes,

Jim

MDW

Pasting data following the last " " in a cell
 
Sounds like you need the InStrRev() function. It finds the LAST instance of a
search string within a source string, but the return value is relative to the
regular order.

strC = "Names Places Cities"

intRev = InStrRev(strC,"")

strLast = Trim(Mid(strC,intRev + 1))

Range("D3").Value = strLast
--
Hmm...they have the Internet on COMPUTERS now!


"Jim Jackson" wrote:

I have a column which contains data separated by " " in two or more
locations within each cell. I need to paste the farthest right data into
another cell.

Example: Names Places Cities etc.

I have searched the Posts her for an idea but nothing gets the desired
result. I have even tried replacing " " with " " but there still are two
or more of these.

Any ideas would be greatly appreciated.

--
Best wishes,

Jim


Jim Jackson

Pasting data following the last " " in a cell
 
It works perfectly!

Thank you. This has been about to drive me more nuts than I already am.

It just goes to show, no matter how much one thinks he has learned, the
surface has only begun to be scratched.
--
Best wishes,

Jim


"MDW" wrote:

Sounds like you need the InStrRev() function. It finds the LAST instance of a
search string within a source string, but the return value is relative to the
regular order.

strC = "Names Places Cities"

intRev = InStrRev(strC,"")

strLast = Trim(Mid(strC,intRev + 1))

Range("D3").Value = strLast
--
Hmm...they have the Internet on COMPUTERS now!


"Jim Jackson" wrote:

I have a column which contains data separated by " " in two or more
locations within each cell. I need to paste the farthest right data into
another cell.

Example: Names Places Cities etc.

I have searched the Posts her for an idea but nothing gets the desired
result. I have even tried replacing " " with " " but there still are two
or more of these.

Any ideas would be greatly appreciated.

--
Best wishes,

Jim


MDW

Pasting data following the last " " in a cell
 
No problem. Glad I could help! :)
--
Hmm...they have the Internet on COMPUTERS now!


"Jim Jackson" wrote:

It works perfectly!

Thank you. This has been about to drive me more nuts than I already am.

It just goes to show, no matter how much one thinks he has learned, the
surface has only begun to be scratched.
--
Best wishes,

Jim


"MDW" wrote:

Sounds like you need the InStrRev() function. It finds the LAST instance of a
search string within a source string, but the return value is relative to the
regular order.

strC = "Names Places Cities"

intRev = InStrRev(strC,"")

strLast = Trim(Mid(strC,intRev + 1))

Range("D3").Value = strLast
--
Hmm...they have the Internet on COMPUTERS now!


"Jim Jackson" wrote:

I have a column which contains data separated by " " in two or more
locations within each cell. I need to paste the farthest right data into
another cell.

Example: Names Places Cities etc.

I have searched the Posts her for an idea but nothing gets the desired
result. I have even tried replacing " " with " " but there still are two
or more of these.

Any ideas would be greatly appreciated.

--
Best wishes,

Jim



All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com