How to Reverse the Order of Words in a Text String

Last reviewed: November 2, 1994
Article ID: Q75513

SUMMARY

You can reverse the order of words in a comma-separated text string by using Excel's FIND, LEFT, LEN, and RIGHT functions.

MORE INFORMATION

Suppose there are two words separated by a comma in cell A1 on your worksheet. A typical example would be "LastName, FirstName". The following formula will reverse the order of the two words and eliminate the comma:

   =RIGHT(A1,(LEN(A1)-(FIND(",",A1)+1)))&" "&LEFT(A1,(FIND(",",A1)-1))

The formula searches for a comma and takes the text that falls to the left of the comma, and concatenates that text to the end of the text that falls to the right of the comma. If A1 contains the text string "Jones, Bill", and you enter the above formula in cell B1, the text string "Bill Jones" is returned.

REFERENCES

"Microsoft Excel Function Reference," version 3.0, pages 76, 137, 200


KBCategory: kbother
KBSubcategory:

Additional reference words: noupd


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.