ISBLANK and Nested IF

alexander21

New member
Joined
Jan 9, 2014
Messages
5
Reaction score
0
Points
0
Hi,

I've had a bit of trouble formatting my nested IF statement. The statement is designed to take a band or artist name, then take the last word of the name and output it. If it contains a number it will output the entire name.

The issue I'm having is when the formula is applied to empty cells (it needs to be there for the client, who do not have much Excel knowledge) - it returns a zero which is fair enough and I can remove this via formatting but that does not allow me to sort the data properly because it detects the zero cells.

To counter this I'm trying to use ISBLANK to remove the zeroes properly but I can't seem to get it to format properly.

What I'm currently using:

Code:
=IFERROR(IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(NOT(ISERR(SEARCH(" ",A2))),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2)),"")

What I'm trying to use:

Code:
=IFERROR(IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(NOT(ISERR(SEARCH(" ",A2))),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2,IF(ISBLANK(B2),""),"")


Sample of A2,A3,A4:

Code:
JESSE JACKSON
JACKSON 5
CHI-LITES

Output B2,B3,B4:

Code:
JACKSON
JACKSON 5
CHI-LITES


Thanks!!
 
Last edited:
How about, checking if A2 is blank first?

e.g

=IF(A2="","",IFERROR(IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(NOT(ISERR(SEARCH(" ",A2))),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2)),""))
 
How about, checking if A2 is blank first?

e.g

=IF(A2="","",IFERROR(IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(NOT(ISERR(SEARCH(" ",A2))),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2)),""))

That looks like it should work, thanks! however now I'm faced with the error of "too many levels of nesting than the file type allows" despite saving in a .xlsx format :shocked:
 
You can probably remove the IFERROR() now, I don't think you will need it.

or you can change formula a bit too:

=IF(A2="","",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2)))

or even

=IF(A2="","",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)),A2)))
 
You can probably remove the IFERROR() now, I don't think you will need it.

or you can change formula a bit too:

=IF(A2="","",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2," ","|",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))),A2)))

or even

=IF(A2="","",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)),A2)))

That's perfect, thank you!!

However it didn't fix the core problem, the zeros (even though they're not ''really'' there) still get counted when using the column to sort, which results in a bunch of empty rows at the top of the spreadsheet, I want them to not be sorted at all (and as a result end up at the bottom of the spreadsheet).
 
Last edited:
If you put column A first in the sort order, the blank cells appear at the bottom (with an A to Z sort)
 
If you put column A first in the sort order, the blank cells appear at the bottom (with an A to Z sort)

That is correct, but the whole idea of the formula is to make the sort on Column B more accurate by providing last names etc. Sorting Column A or C would make the formula pointless
 
That is correct, but the whole idea of the formula is to make the sort on Column B more accurate by providing last names etc. Sorting Column A or C would make the formula pointless

Obviously you have the advantage as I haven't seen your data, but my idea was to sort by col A, and then by Col B therefore getting all the blanks to the bottom
and then sort again by Col B excluding the blank rows.
 
You could change formula to:

=IF(A2="","zzzzz",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)),A2)))

then conditionally format the column to hide the zzzzz then they will sort to the bottom.
 
Last edited:
You could change formula to:

=IF(A2="","zzzzz",IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A2))>0,A2,IF(ISNUMBER(SEARCH(" ",A2)),TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)),A2)))

then conditionally format the column to hide the zzzzz then they will sort to the bottom.

The column is generally always hidden anyway so I wouldn't even need to hide the zzzzz, this works though so thank you very much and thank you to everyone else.
 
Back
Top