Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Formula to delete rightmost N characters

I have some cell containing text of various lengths. I'd like to delete the
rightmost 5 characters of each cell.

What comes to mind is LEFT(A1, LEN(A1) - 5). Is there a simpler way?

I'm using Excel 2005.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Formula to delete rightmost N characters

Your formula looks almost perfect to me. Only thing I'd change is make it:

=LEFT(A1,MAX(0,LEN(A1)-5))

In case any of your text is less than 5 characters in length.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Eric_NY" wrote:

I have some cell containing text of various lengths. I'd like to delete the
rightmost 5 characters of each cell.

What comes to mind is LEFT(A1, LEN(A1) - 5). Is there a simpler way?

I'm using Excel 2005.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Formula to delete rightmost N characters

Thanks.

I sometimes wish Excel had a more complete set of functions. It's typically
possible to manipulate existing functions to do what's needed, but it's
sometimes more difficult or convoluted than necessary. Whenever I see a
formula where the same value appears twice (like A1 in LEFT(A1, LEN(A1) - 5)
), it seems somehow un-aesthetic or at least un-economical. It's not so bad
if the duplicated text is short, like A1, but I often find myself repeating
lengthy sub-formulas because the function I really want is missing.

For example, what's needed here is a function such as LOPOFFRIGHT(A1,5),
which lops off the rightmost 5 characters. Obviously a similar LOPOFFLEFT
function.

Someday I'll teach myself VBA so I can write these formulas myself.

Anyway, thanks for your help.

"Luke M" wrote:

Your formula looks almost perfect to me. Only thing I'd change is make it:

=LEFT(A1,MAX(0,LEN(A1)-5))

In case any of your text is less than 5 characters in length.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Eric_NY" wrote:

I have some cell containing text of various lengths. I'd like to delete the
rightmost 5 characters of each cell.

What comes to mind is LEFT(A1, LEN(A1) - 5). Is there a simpler way?

I'm using Excel 2005.

Thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete characters at the end Stan Excel Discussion (Misc queries) 5 July 9th 09 08:26 PM
Formula for rightmost set of values brumanchu Excel Discussion (Misc queries) 3 October 7th 08 10:13 PM
delete non numberic characters David T Excel Discussion (Misc queries) 6 September 7th 06 04:13 AM
how to delete the 4 rightmost digits from a cell charlene Excel Worksheet Functions 4 June 29th 06 03:11 PM
Formula ? Return value from rightmost non-blank cell in a row of tgdavis Excel Worksheet Functions 8 April 27th 06 01:00 PM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"