Take a cell and use only the 4 right most characters

  • Thread starter Thread starter summerd
  • Start date Start date
S

summerd

I have an Excel file that has 9 digits in a cell (and the entire column
below it). I want to strip off the righthand 4 characters and replace
the cell contents with these 4 characters.

In the old days when I used to program (FORTRAN, COMPASS, etc), I would
take the contents and shift it so that there were only the 4 characters
left, truncating if necessary. But with Excel, I don't know exactly
how to do it.

Also, I was thinking of making it into a Macro so that I don't have to
do 40 rows by hand....

Thanks

Dave

(reply in thread, please)
 
summerd > said:
I have an Excel file that has 9 digits in a cell (and the entire column
below it). I want to strip off the righthand 4 characters and replace
the cell contents with these 4 characters.

In the old days when I used to program (FORTRAN, COMPASS, etc), I would
take the contents and shift it so that there were only the 4 characters
left, truncating if necessary. But with Excel, I don't know exactly
how to do it.

Also, I was thinking of making it into a Macro so that I don't have to
do 40 rows by hand....

Thanks

Dave

Suppose your values are in column A starting at A1. In B1 put this formula:
=VALUE(RIGHT(A1,4))
Then copy this down column B as far as your data goes in column A. (You can
use Copy and Paste, or click in cell B1 and just drag the fill handle - the
little black square at the bottom right of the cell.)

If you wish, you can then select column B, copy it, then select column A and
use Paste Special > Values to overwrite the original data. Then you can
delete column B.

Don't be put off; it is quicker to do than to describe!
 
there had to be an easy way to do it!

And the command "value(right(cell,4))" was what I was looking for.

This is great; just before class, I posted the request and I came back
from class and voila! here's the answer.

Thanks, again to you both.

Dave
 
Back
Top