nested iserror gives error

johnmerlino

Board Regular
Joined
Sep 21, 2010
Messages
94
Hey all,

I have a query:
Code:
=IF( ISERROR( SEARCH("&", J2) ), IF( ISERROR( SEARCH(" ", J2) ), J2, LEFT(J2,LOOKUP(2^15,FIND(" ",J2,ROW(INDIRECT("1:"&LEN(J2)))))-1)),SUBSTITUTE(J2,MID(J2,FIND(",",J2,1)+1,FIND("&",J2,1)-FIND(",",J2,1)),""))
It converts this:
Code:
AVERNA,ROBERT C        
Corn,Marlin       
Lizand,ROBERT H        
CATANESE,SALVATORE J & OLGA M       
JIMENEZ,ALEJANDRO & HILDA M     
Martin,Harry & Marie Anne Hernara
into this:

Code:
AVERNA,ROBERT C       
Corn,Marlin       
Lizand,ROBERT H       
CATANESE, OLGA M       
JIMENEZ, HILDA M     
Martin, Marie Anne Hernara
Problem is with this:
Code:
Sarah Ann Little Junior

it converts it incorrectly into this:
Code:
Sarah Ann Little
when I'd want to keep it just as this:
Code:
Sarah Ann Little Junior
I tried adding a nested iserror to return original row if it doesn't find a comma:
Code:
=IF( ISERROR( SEARCH("&", A1) ),IF( ISERROR( SEARCH(",", A1)),A1,IF( ISERROR( SEARCH(" ", A1) ), A1, LEFT(A1,LOOKUP(2^15,FIND(" ",A1,ROW(INDIRECT("1:"&LEN(A1))))))-1)),SUBSTITUTE(A1,MID(A1,FIND(",",A1,1)+1,FIND("&",A1,1)-FIND(",",A1,1)),""))
But it gives me this:
Code:
#VALUE!
Thanks for response.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try this...
Code:
=IF(ISNUMBER(FIND("&", J2)),
      SUBSTITUTE(J2,MID(J2,FIND(",", J2)+1,FIND(" &", J2)-FIND(",", J2)+2), ""),J2)
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top