+ Reply to Thread
Results 1 to 6 of 6

If cell = "text" then x=1, if not x=2

  1. #1
    Registered User
    Join Date
    07-08-2014
    Location
    NJ
    MS-Off Ver
    14.4.3 Mac
    Posts
    4

    If cell = "text" then x=1, if not x=2

    Okay, apologies from the start, this is probably the most basic newbie question but I cannot get this to work after trawling Excel help and many web pages.

    I have a cell that has a text result of Yes or No, and depending on that answer I need x (or the cell result) to be 1 (yes) or 2 (no)

    Tried these, can't get them to work:
    If(C1 = yes, x=1, x=2)
    If(C1 = "yes", x=1, x=2)

    Excel:mac 2011 14.4.3 (140616)

    Thanx
    x
    Emily

  2. #2
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: If cell = "text" then x=1, if not x=2

    =IF(C1="Yes",1,2)
    Excel Guru in the making

    <----------If the question has been answered to your satisfication please click the Add Repuation star to the left

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: If cell = "text" then x=1, if not x=2

    Hi Emily
    No question or query is classed as "basic". We only know what we know at the end of the day. This is why these forums exist so that we can help and support each other .
    If I underestadn you correctly then try this formula:
    =IF(C1="Yes",1,2)
    This would place a "1" in the cell if C1 was equal to "Yes", if not it will place a "2" in the cell.
    Hope this helps.
    Tony

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If cell = "text" then x=1, if not x=2

    The very robust version of the formula would be:

    =IF(C1="Yes",1,IF(C1="No",2,""))

    If the only possible cell entries will be either Yes or No (and nothing else, not even a blank cell):

    =1+(C1="No")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    07-08-2014
    Location
    NJ
    MS-Off Ver
    14.4.3 Mac
    Posts
    4

    Re: If cell = "text" then x=1, if not x=2

    Awesome, you guys are QUICK!
    Thanx again!
    x
    Em
    Last edited by emilycurious; 07-08-2014 at 10:31 AM.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If cell = "text" then x=1, if not x=2

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Cell Color with"if" statement testing for a "text" value
    By ARocketScientist in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-08-2014, 09:01 PM
  2. Find "TEXT 1" in a range and enter "TEXT 2" in the adjacent cell
    By madreag in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-28-2013, 05:34 PM
  3. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  4. Replies: 2
    Last Post: 08-02-2011, 06:57 AM
  5. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1