View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\)[_80_] Rick Rothstein \(MVP - VB\)[_80_] is offline
external usenet poster
 
Posts: 1
Default Split Cell Across Two Columns

Assuming all your "double names" are structured as shown (with the comma
and
the word "and"), give these two formulas (which assume your names are in
A1)
a try...

B1: =MID(A1,FIND(",",A1)+2,IF(ISERROR(FIND(" and ",A1)),LEN(A1)+1,FIND("
and ",A1))-FIND(",",A1)-2)&" "&LEFT(A1,FIND(",",A1)-1)

C1: =IF(ISERROR(FIND(" and ",A1)),"",MID(A1,FIND(" and ",A1)+4,99)&"
"&LEFT(A1,FIND(",",A1)-1))

You can then copy these down as required. By the way, these formulas
should
work whether there is a second name attached with the word "and" in Column
A
or not.


It does give an error if there's no comma. But ...


Hmm! Based on what the OP posted, it didn't seem likely that there would not
be a comma... the names appeared to be arranged as last-comma-first (plus
possibly a second name). What would be listed if there was not comma...
first-last? Well, it is fixable, just in case...

B1: =IF(ISERROR(FIND(",",A1)),A1,MID(A1,FIND(",",A1)+2 ,IF(ISERROR(FIND(
" and ",A1)),LEN(A1)+1,FIND(" and ",A1))-FIND(",",A1)-2)&" "&LEFT(A1,FIND(
",",A1)-1))

No change is needed for the formula in C1.


A suggestion, Rick:

Your formulas are multi-line and break on the <space after the <". I
have
found that if I break these long formulas in the formula bar, at an
appropriate
length, using <alt-enter, I can then paste them into my newsreader and
they
can be copy/pasted directly back into a formula bar, and work with no
further
editing.


Yes, good point.


Rick