+ Reply to Thread
Results 1 to 3 of 3

Extract the nth character in a string of text

  1. #1
    Registered User
    Join Date
    10-10-2006
    Posts
    3

    Extract the nth character in a string of text

    Hi all,

    I'm trying to find/create a function to extract the nth character in a string of characters.

    For instance, in A1 I have the text:
    "wheninthecourseofhumaneventsitbecomesnecessaryforonepeopletodissolvethepoliticalbandswhichhaveconnectedthemwithanotherandtoassumeamongthepowersoftheearththeseparateandequalstationtowhichthelawsofnatureandofnaturesgodsentitlethemadecentrespecttotheopinionsofmankindrequiresthattheyshoulddeclarethecauseswhichimpelthemtotheseparation"

    I'm trying to extract the characters 33, 36, 38, 25, etc.

    Any idea ?

    Please note that I can't use VB so it would have to be an excel formula (if possible) !

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,196
    Quote Originally Posted by Chopin
    Hi all,

    I'm trying to find/create a function to extract the nth character in a string of characters.

    For instance, in A1 I have the text:
    "wheninthecourseofhumaneventsitbecomesnecessaryforonepeopletodissolvethepoliticalbandswhichhaveconnectedthemwithanotherandtoassumeamongthepowersoftheearththeseparateandequalstationtowhichthelawsofnatureandofnaturesgodsentitlethemadecentrespecttotheopinionsofmankindrequiresthattheyshoulddeclarethecauseswhichimpelthemtotheseparation"

    I'm trying to extract the characters 33, 36, 38, 25, etc.

    Any idea ?

    Please note that I can't use VB so it would have to be an excel formula (if possible) !
    Try

    =Mid(A$1&" ",B1,1)

    where B1 contains the number of the character required

    the formula can then be formula-filled downwards for other characters.

    The &" " should (if required) provide enough length to A1 to not produce an error (which shouldn't happen with your text)

    hth
    ---

  3. #3
    Registered User
    Join Date
    10-10-2006
    Posts
    3

    Thumbs up

    It works perfectly !!

    Thanks for your help hth !!

+ 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