+ Reply to Thread
Results 1 to 6 of 6

Using And statement in If stagement

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Using And statement in If stagement

    What am I doing wrong here? This is always triggering the "Else" part of the statement even though both A1 and A2 are 1.



    =IF(AND(A1="1",A2="1"), "Both are 1", "Both are not 1")

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Using And statement in If stagement

    Get rid of those quotes!

    =IF(AND(A1=1,A2=1), "Both are 1", "Both are not 1")
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Using And statement in If stagement

    Try without quotes for the numbersto enusre Excel reads them as numbers and not as text

    =IF(AND(A1=1,A2=1),"Both are 1","Both are not 1")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Using And statement in If stagement

    Is the value of A1 and A2 Numerical or text?

    You have it as text

    try
    =IF(AND(A1=1,A2=1), "Both are 1", "Both are not 1")

  5. #5
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Using And statement in If stagement

    Ahaaa!!! That was my problem. Didn't need the quotes. Thanks!

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Using And statement in If stagement

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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