chop off last 5 characters of a string

Giganews Newsgroups
Subject: chop off last 5 characters of a string
Posted by:  Jeff (…@thanks.com)
Date: Tue, 3 Mar 2009

I have a list of strings that vary in length from 10 to 15 characters.  The
last 5 characters are always different but always a length of 5 characters
and I want to chop them off and keep only the left part of the string, which
varies in length from 5 to 10 characters.  Is there a VBA or SQL or Excel
function that will do this all in one shot for the whole list?

for example, let's say you have the following strings (using numbers as
strings for visual clarity)

12345678905555a
1234567895555b
123456785555c
12345675555d
1234565555e

the function should return

1234567890
123456789
12345678
1234567
123456

The right() function extracts but does not chop off characters and return
the leftmost characters
The left() function won't work because the number of leftmost characters
varies randomly
The trim() functions only work with spaces as far as I know, but it would be
nice if I could use a function like trim to trim off the last 5 characters,
but I don't know if there is one.

Thanks...

Jeff

Replies