Parsing Names in a Worksheet Without Data Parse in ExcelLast reviewed: April 29, 1997Article ID: Q72573 |
The information in this article applies to:
SUMMARYYou can parse data into separate cells by entering formulas into the first row of a worksheet and filling those formulas down. In those cases where using the Data Parse command isn't working properly, and you do not want to write a macro, this may be desirable.
MORE INFORMATIONThe following example will accept names and parse the names into three columns (first name, middle initial, last name), skipping the middle initial column if no middle initial exists. NOTE: The Microsoft Excel version 3.0 and 4.0 macro add-in, FLATFILE.XLA, Data Smart Parse command will parse in a similar way, except that it does not skip any columns.
ExampleEnter the following names into the appropriate cells:
A1: Mary J. Smith A2: Joshua JohnstonEnter the following formulas into the appropriate cells:
B1: =SEARCH(" ",A1) C1: =SEARCH(" ",A1,SEARCH(" ",A1)+1) D1: =LEFT(A1,B1-1) E1: =IF(ISERROR(C1)," ",MID(A1,B1+1,C1-B1)) F1: =IF(ISERROR(C1),RIGHT(A1,LEN(A1)-B1),RIGHT(A1,LEN(A1)-C1)) Select cells B1:F2 and choose Fill Down from the Edit menu. Cells D1:F2 will look as follows:
D1: Mary E1: J. F1: Smith D2: Joshua E2: F2: JohnstonThis works well and easily if the customer doesn't want to use a macro, or if the data doesn't parse easily. After parsing the data this way, you will want to remove all the formulas by doing the following:
REFERENCESFor more information about the Search function, click the Index tab in Excel 97 Help, type the following text
search worksheet functionand then double-click the selected text to go to the "SEARCH" topic. "Function Reference," version 4.0, pages 248-253, 274-274, 373-374 "Function Reference," version 3.0, pages 135-138, 151-152, 208-209
|
Additional query words: 97 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |