Calculated column based on two different columns

Lauren 21 Reputation points
2022-12-07T12:23:56.233+00:00

Hello, I am trying to set up a calculated column to say:

If Column A is not blank, "statement1",
if Column B is not blank, "statement 2",
if Column A & Column B are not blank, "Statement 1 & 2",
otherwise state "Blank".

For some reason I can't get this working? E.g. if I try something like this, it just stops at column A when both are true.

=IF([columnA]<>"","statement1",IF([columnB]<>"","statement2"))

Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

Answer accepted by question author
  1. Jinwei Li-MSFT 4,741 Reputation points Microsoft External Staff
    2022-12-08T06:45:01.48+00:00

    Hi @Lauren ,

    Please try to use this.

    =IF(AND(ColumnA="",ColumnB=""),"BLANK",IF(AND(NOT(ColumnA=""),ColumnB=""),"statement1",IF(AND(NOT(ColumnA=""),NOT(ColumnB="")),"statement1&2","statement2")))  
    

    Output:
    268531-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lauren 21 Reputation points
    2022-12-08T09:24:54.407+00:00

    Hi JinweiLi-MSFT, spot on, thank you so much!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.