The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

[RESOLVED]Need [Excel] guru help!

ChanusChanus Harbinger of the Spicy Rooster ApocalypseThe Flames of a Thousand Collapsed StarsRegistered User, Moderator mod
edited November 2009 in Help / Advice Forum
Is there anything like a "Contains X_Value" type argument for the IF statement?

Example:

I have a part number in a cell like TY05407 and then also TY05407Q and I need to set up a column so that everything with the Q gets one value and everything without gets another... but the part numbers aren't all the same length, so I can't just do a cell split.

So I would want something (algorithmically) like:

IF(A1 contains 'Q',Q,X)

So if it has Q in the part number, the value will be 'Q' and if not, the value will be 'X'


Thanks!

Allegedly a voice of reason.
Chanus on

Posts

  • localh77localh77 Registered User regular
    edited November 2009
    What you want is the SEARCH function. So in your case:

    SEARCH("Q",A1)

    If it fails, it'll return an error, so you can wrap it in an ISERROR, like this:

    =IF(ISERROR(SEARCH("Q",A1)),"X","Q")

    localh77 on
  • ChanusChanus Harbinger of the Spicy Rooster Apocalypse The Flames of a Thousand Collapsed StarsRegistered User, Moderator mod
    edited November 2009
    Oh, awesome.

    Thanks!

    Chanus on
    Allegedly a voice of reason.
  • ChanusChanus Harbinger of the Spicy Rooster Apocalypse The Flames of a Thousand Collapsed StarsRegistered User, Moderator mod
    edited November 2009
    That worked perfectly. You're my hero.

    Chanus on
    Allegedly a voice of reason.
This discussion has been closed.