• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Anyway to use text variables in an 'IF'?

Jediantman

New Member
Just wondered if there was anyway to use a variable 'search' within an IF so that I can avoid overloading a nested IF.

I want to search for the characters 'S5' in a particular cell, but those characters can appear in around 7 or 8 codes that will occupy the cell, so I guess I'm looking for a wildcard control.

As an example the basic formula I have is:
=IF(D4="S5",IF(OR(ISBLANK(H4),H4=""),"",WORKDAY(H4,1,holidays)))
which will work fine if D4 has exactly that code, but I want it to be able to look into D4 and then do the calculation if those characters are in there at all, without having to expand into IFs that check on all the variables.

Any ideas?
 
Hi Jediantman,

Try this :

=IF(ISNUMBER(SEARCH("S5",D4,1)),IF(OR(ISBLANK(H4),H4=""),"",WORKDAY(H4,1,holidays)))
 
Back
Top