ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Need insert a dash in between last 4 digits in text string (https://www.excelbanter.com/excel-worksheet-functions/41711-need-insert-dash-between-last-4-digits-text-string.html)

Phil

Need insert a dash in between last 4 digits in text string
 
I have a column (TractID) that has a 10 character text string, like the
following entry: 0190003164.

First, I need to grab the last four digits (3164) of the entry, copy them to
the next column (PropertyID), then insert a dash (-) between the 3rd to last
(from the R) and the 2nd to last characters.

The data in the column will always be the same format, if that helps.

How do I do this?

Alok

If the text is in A1 then enter the following formula in B1
=Mid(A1,7,2) & "-" & Mid(A1,9,2)
Alok

"Phil" wrote:

I have a column (TractID) that has a 10 character text string, like the
following entry: 0190003164.

First, I need to grab the last four digits (3164) of the entry, copy them to
the next column (PropertyID), then insert a dash (-) between the 3rd to last
(from the R) and the 2nd to last characters.

The data in the column will always be the same format, if that helps.

How do I do this?


JE McGimpsey

One way:

=MID(A1,7,2) & "-" & RIGHT(A1,2)

another:

=TEXT(RIGHT(A1,4),"00-00")

In article ,
"Phil" wrote:

I have a column (TractID) that has a 10 character text string, like the
following entry: 0190003164.

First, I need to grab the last four digits (3164) of the entry, copy them to
the next column (PropertyID), then insert a dash (-) between the 3rd to last
(from the R) and the 2nd to last characters.

The data in the column will always be the same format, if that helps.

How do I do this?


Phil

Thanks. It worked great.

"Alok" wrote:

If the text is in A1 then enter the following formula in B1
=Mid(A1,7,2) & "-" & Mid(A1,9,2)
Alok

"Phil" wrote:

I have a column (TractID) that has a 10 character text string, like the
following entry: 0190003164.

First, I need to grab the last four digits (3164) of the entry, copy them to
the next column (PropertyID), then insert a dash (-) between the 3rd to last
(from the R) and the 2nd to last characters.

The data in the column will always be the same format, if that helps.

How do I do this?



All times are GMT +1. The time now is 04:35 PM.

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