ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cut off part of cell entry (https://www.excelbanter.com/excel-programming/319185-cut-off-part-cell-entry.html)

Orion[_2_]

cut off part of cell entry
 
Hi there,

how can I cut off part of a cell entry?

cell entry: CA M 3
I would like to cut off the first two digits: CA

Thanks for any help

Regards,
Norbert

Don Guillett[_4_]

cut off part of cell entry
 
try this sub
sub trimcells()
for each cel in selection
cel.value=trim(right(cel,len(cel)-2))
next cel
end sub
--
Don Guillett
SalesAid Software

"Orion" wrote in message
...
Hi there,

how can I cut off part of a cell entry?

cell entry: CA M 3
I would like to cut off the first two digits: CA

Thanks for any help

Regards,
Norbert




Orion[_2_]

cut off part of cell entry
 

Hi Don,

thanks very much for your hint, but I actually have to cut of
everything but the 2 digits on the left hand side. I should have made
myself a bit more clear. Sorry for that.

CA M 1 should become CA
PB Col 2 should become PB

I tried =trim(left(cel,len(cel)-4))
which works for the first example, but not for the second one, due to
the different entry length.

Regards,
Norbert


On Fri, 17 Dec 2004 08:29:59 -0600, "Don Guillett"
wrote:

try this sub
sub trimcells()
for each cel in selection
cel.value=trim(right(cel,len(cel)-2))
next cel
end sub



Orion[_2_]

cut off part of cell entry
 
Oh no,
now I found out by myself. It's actually so easy!
=left(cel,2)
(this I will not forget anymore!)

Thanks anyway
Norbert



On Mon, 20 Dec 2004 10:19:06 +0200, Orion wrote:


Hi Don,

thanks very much for your hint, but I actually have to cut of
everything but the 2 digits on the left hand side. I should have made
myself a bit more clear. Sorry for that.

CA M 1 should become CA
PB Col 2 should become PB

I tried =trim(left(cel,len(cel)-4))
which works for the first example, but not for the second one, due to
the different entry length.

Regards,
Norbert


On Fri, 17 Dec 2004 08:29:59 -0600, "Don Guillett"
wrote:

try this sub
sub trimcells()
for each cel in selection
cel.value=trim(right(cel,len(cel)-2))
next cel
end sub




All times are GMT +1. The time now is 05:22 PM.

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