CHISA
CHISA

Reputation: 13

ERROR Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 4 arguments

I'm trying to create logic but return #N/A as mentioned in the title, what did I do wrong?

=IF(AND(I4=B4,I4=B5,I4=B6),CONCATENATE(B4,";",B5,";",D6),IF(AND(I4=B4,I4=B5),CONCATENATE(D4,";",D5)),IF(I4=B4,D4)), but got error.

Upvotes: 0

Views: 727

Answers (2)

Martín
Martín

Reputation: 10277

You have an extra closing parenthesis after the second Concatenate formula. You're missing to a final scenario when I4 differs from B4, it'll just return FALSE, you can add an extra comma after D4 and specify what you want it to return:

=IF(AND(I4=B4,I4=B5,I4=B6),CONCATENATE(B4,";",B5,";",D6),IF(AND(I4=B4,I4=B5),CONCATENATE(D4,";",D5),IF(I4=B4,D4,"I4 and B4 are different")))

Upvotes: 1

player0
player0

Reputation: 1

use:

=IF(AND(I4=B4,I4=B5,I4=B6), B4&";"&B5&";"&D6, 
 IF(AND(I4=B4,I4=B5), D4&";"&D5, IF(I4=B4, D4, )))

Upvotes: 0

Related Questions