简体   繁体   中英

nested IF(AND(ISBLANK)) Statement not working?

I have a formula that is supposed to place an "X" if a value populated in one or more of three columns (J,R,AL).

=IF(AND(ISBLANK(J:J),ISBLANK(R:R)),ISBLANK(AL:AL))),"","x")

It gives an argument error message, and I know it has something to do with the syntax structure of the parentheses. Can anyone help me figure out how to edit this?

It is not clear to me exactly what you have intended here, but you have an inappropriate number of parentheses. Google Sheets detects this error correctly right away, and I would be surprised if Excel didn't also give you a clearer error message.

=IF(
  AND(
    ISBLANK(J:J),ISBLANK(R:R)
     ),
  ISBLANK(AL:AL)
   )
),"","x")   /// <--- all of this is trailing junk

Perhaps your intention was to check if all of them were blank? You would still have one too many parentheses and you would need an extra AND , but at least your number of arguments would also make more sense.

=IF(AND(AND(ISBLANK(J:J),ISBLANK(R:R)),ISBLANK(AL:AL)),"","x")

An easier variation of your formula would be

=IF(COUNTA(J:J, R:R, AL:AL) > 0, "X", "")

Formula COUNTA counts non-empty cells. So the moment there is one non-empty it means there is data somewhere in at least one of these columns.

In my opinion, a much more elegant solution


EDIT: As found out in the comments, formula isn't supposed to check for entire column, but only for values in the colums per row. So, it should be:

(presuming your data starts at J1 , R1 , AL1 )

=IF(COUNTA(J1, R1, A1) > 0, "X", "")

This will return the desired result

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM