简体   繁体   中英

Excel IF formula with 3 outputs in a single cell

I am currently working on a sheet where I'm having an issue.

The problem is that I want 3 different outputs to be shown in a single cell using 3 different conditions. Attaching an image for reference.

参考图片

Suppose, a person is getting vaccinated and he has taken both shots so the "Ref" cell will show "Done" one after another and the "Status" will show "Done".

Now, there's one guys who hasn't taken any shots yet so the "Ref" cell will show "Incomplete" one after another and the "Status" will show "Incomplete".

But there's a person who has taken his first shot and is awaiting his time for the second shot so the "Ref" cell will show "Complete" and "Incomplete" one after another and here the "Status" should show "Partial".

How can it be done?

You can try following formula:

=CHOOSE(COUNTIF(A2:A3,"Done")+1,"Incomplete","Partial","Done")

where we use COUNTIF formula to arrive at text string selection.

Looks quite easy:

=IF(AND(A2="Done",A3="Done"),
    "Done",
    IF(OR(A2="Done",A3="Done"),
       "Partial",
       "Incomplete"))

If both A2 and A3 equal "Done", you get "Done".
If A2 or A3 equal "Done", you get "Partial.
Else you get "Incomplete".

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