+ Reply to Thread
Results 1 to 7 of 7

Loop and Trim based on condition

  1. #1
    Registered User
    Join Date
    08-25-2005
    Posts
    37

    Loop and Trim based on condition

    Hi:

    I've got a column that I'd like to loop to the end, and if the value of the text in that cell starts with an A or number, I want to strip out everything except the first 10 characters.

    How would I do that?

    Thanks, Paul

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Loop and Trim based on condition

    Here, try this:
    Attached Files Attached Files

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Loop and Trim based on condition

    Formula wise - based on zbor's file - perhaps:

    =LEFT(A1,IF(OR(LEFT(A1)="a",ISNUMBER(--LEFT(A1))),10,LEN(A1)))

    If you want a VBA routine to replace the originals then you could use something like:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-25-2005
    Posts
    37

    Re: Loop and Trim based on condition

    Zbor and DonkeyOte.

    Wow. That worked great. Thanks, it is much appreciated!

  5. #5
    Registered User
    Join Date
    08-25-2005
    Posts
    37

    Scrunching Multiple Record Fields Into One Top-level Field

    Oops wanted new thread!
    Last edited by SWMagic; 03-25-2010 at 12:44 PM.

  6. #6
    Registered User
    Join Date
    08-25-2005
    Posts
    37

    Scrunching Multiple Record Fields Into One Top-level Field

    Well this is embarrassing. New Post doesn't really mean that does it...

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Loop and Trim based on condition

    New post doesn't really mean that does New thread

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1