-1

I am trying to make the following situation work. I have tried several things and truthfully I think I'm over complicating.

I need to do this:

If a1=b1, then return the actual text in c1, if a1 does NOT =b1, return actual text in c2

Alternatively

If A1=B1, return actual text in C1, if A1=B2, return actual text in C3.

Can anyone help me out on this?

5
  • 2
    Welcome! It seems to me that you are looking for the function IFS() to make a formula similar to =IFS(A1=B1,C1,A1=B2,C3,A1<>B1,C2)
    – JohnSUN
    Commented Nov 10, 2022 at 16:00
  • @JohnSUN Looks like an answer to me. Suggest you post it.
    – Tedinoz
    Commented Nov 11, 2022 at 0:40
  • "Alternatively If A1=B1, return actual text in C1, if A1=B2, return actual text in C3." You say "alternatively", but this is a completely different scenario than your initial problem of "If a1=b1, then return the actual text in c1, if a1 does NOT =b1, return actual text in c2". I suggest that you post this as a new question AND supply some sample data AND an example of how a successful outcome would appear. Lastly, in your "alternative", what does one do if "A1" does not equal "B1" or "B2".
    – Tedinoz
    Commented Nov 11, 2022 at 0:46
  • @Tedinoz Actually this only seems like an answer - the formula implements the logic as I have read and understood the question. In fact, this may not be what the user wanted to ask about at all.
    – JohnSUN
    Commented Nov 11, 2022 at 6:59
  • @JohnSUN If the answer doesn't address the OP's question, then the OP can say as much. OTOH, if the question is unclear, then it should be closed as requiring more details.
    – Tedinoz
    Commented Nov 12, 2022 at 7:35

1 Answer 1

0

There are several ways to implement logic based on multiple comparisons. For example, if values are defined for each of the possible options, then you can use this trick using the CHOOSE() function

Several nested IF() functions are difficult to understand if there are more than two.

To solve the combination of conditions you describe, you can use function IFS() to make a formula similar to =IFS(A1=B1,C1,A1=B2,C3,A1<>B1,C2)

Please be careful when listing the function parameters - the sequence matters! For example, the formula =IFS(A1=B1,C1,A1<>B1,C2,A1=B2,C3) , although it looks like the correct one, has a logical error: since the first and second conditions contradict each other, either the first or second option will return TRUE and the function will terminate without reaching the third condition, the value of C3 will not be received.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.