Announcement

Collapse
No announcement yet.

Extract The First Letter Of A String

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extract The First Letter Of A String



    How can I extract the first letter of a string?

  • #2
    Re: Extract The First Letter Of A String

    nevermind, got it

    Code:
     newString = left(originalString, 1)
    Where 1 is the number of characters you want to extract.

    Comment


    • #3
      Re: Extract The First Letter Of A String

      there is also a worksheet function that does the same:

      =left(A1,1)

      where A1 is a cell containing the string to evaluate (you can also input the string directlly into this formula instead of the cell reference if you want to.)

      Comment


      • #4


        Re: Extract The First Letter Of A String

        LEFT(TRIM(B1),1)

        By using the TRIM function, you will remove all leading spaces at the beginning of the string.
        By using the LEFT function on the previously trimmed string, the returned character will be the first non-blank character from the string, be it a letter or number.

        Comment

        Working...
        X