Thursday, September 2, 2010

Get the First Letter of a String in Excel

How do I cut out the first letter from a cell in a Microsoft Excel worksheet?

You can do this with the LEFT() function. This function lets you extract a substring of a given length from a larger string. It takes two parameters:

  1. text – The text from which to extract your substring.
  2. num_chars – The number of characters you want to extract.

By suppling the cell containing your original text as the first parameter and a length of 1 as the second parameter, we can use Excel's LEFT function to get the first letter. Here's a screenshot of a sample spreadsheet I set up:

Screenshot of a spreadsheet in Excel

In order to populate the "Middle Initial" column with the first letter from each name in the "Middle Name" column, I entered the following formula into C2:

=LEFT(B2, 1)

I then dragged it down to all my rows (in this case just the two of them) and got the result I was looking for:

Excel spreadsheet with first letter of each name populated

Since this is a formula, the first letters in the "Middle Initial" column will automatically update if you make a change to the source text.

You can extract a larger substring by just changing the second parameter to a higher number.


No comments:

Post a Comment