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.
=IFS(A1=B1,C1,A1=B2,C3,A1<>B1,C2)