SOLVED

If within an If then another then another...(with a twist)

Iron Contributor

Hello,

I've been trying to figure out the syntax for my formula but I can't. I need your help.

 

Okay, here is what I am trying to do:

 

IF a value is find in a given range do another if(match) then if another value is find that range do another if(match) so on... But for each specific 'if' if the value is not found then set the value of the cell "sth".

 


=IF(MATCH(Names!A2,S17:S20,0),IF(MATCH(Names!A3,S17:S20),IF(MATCH(Names!A4,S17:S20),"sth","sth1","sth2")

 

This is what I've been tinkering with but I can't get it to work. Where should I put the value if false for every if?

 

So if first one evaluates true, the true condition of that statement is another if statement. in that statement there is another if statement. for each if statement I need to set the value to sth if it evaluates false then stop there. I'm having trouble placing the false portion of each if.

 

Am I making any sense?

3 Replies

@kheldar 

What do you want to return if the third match is found?

best response confirmed by kheldar (Iron Contributor)
Solution

@kheldar 

As variant

=IF( ISNA( MATCH( Names!A2, S17:S20, 0 ) ),
     IF( ISNA( MATCH( Names!A3, S17:S20, 0 ) ),
         IF( ISNA( MATCH( Names!A4, S17:S20, 0 ) ),
             "not found",
              "sth2"
          ),
          "sth1"
      ),
     "sth" )
Sorry for not seeing your response, I thought I had mail notifications on.
1 best response

Accepted Solutions
best response confirmed by kheldar (Iron Contributor)
Solution

@kheldar 

As variant

=IF( ISNA( MATCH( Names!A2, S17:S20, 0 ) ),
     IF( ISNA( MATCH( Names!A3, S17:S20, 0 ) ),
         IF( ISNA( MATCH( Names!A4, S17:S20, 0 ) ),
             "not found",
              "sth2"
          ),
          "sth1"
      ),
     "sth" )

View solution in original post