+ Reply to Thread
Results 1 to 7 of 7

IF with AND

  1. #1
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Question IF with AND

    Hi All,
    I have been working on a formula to return a value based on conditional input into specified cells. I have gone through tutorials and searched the forums but can’t work out whether it is possible to achieve what I am setting out to do through just a formula or whether it would have to be a VBA solution.

    So here is a basic version of what I have currently:

    Please Login or Register  to view this content.
    So in column A I have a number of cells that will contain 0 or > 0. I would like the formula to step through the specified cells as shown above and the first 1 to contain > 0 returns its corresponding answer e.g

    IF A1 > 0 Then return “Answer1”
    ElseIF
    IF A1 = 0 & A2>0 Then return “Answer2”
    ElseIF
    IF A1 = 0 & A2 = 0 & A3 >0 Then return “Answer3”


    Any help on how to achieve this would be wonderful.

    Many Thanks!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF with AND

    Is it just 3 cells? If not, how many?
    What are the "Answer"s ?
    Are they going to be residing in other cells somehwere? Which cells? Or will they be hard coded into the formula?

    Can you post a sample book?
    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: IF with AND

    How about:

    Please Login or Register  to view this content.
    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: IF with AND

    Maybe:

    =IF(A1=0,IF(A2>0,"Answer 2",IF(A2=0,IF(A3>0,"Answer 3",""),"")),IF(A1>0,"Answer 1",""))
    Quang PT

  5. #5
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: IF with AND

    Thanks guys for the responces.
    To Jonmo1:
    There are just 3 cells.
    The "Answers" are hard coded, calculations that would be run in that case being returned. What it actually is, is this:
    Please Login or Register  to view this content.
    Makes it rather messy to look at so subed "Answer"

    I can't really post a sample book as its too full of senstive data. I could if you'd like mock something up. But it would only really contain a 0 in A1 etc.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF with AND

    Try

    =IF(A1>0,Answer1,IF(A2>0,Answer2,IF(A3>0,Answer3,"")))

  7. #7
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: IF with AND

    Thank you guys for all your answers!
    bebo021999 yours worked really well, Thank you!
    ConneXionLost yours returned a #Value error, which mine was returning too.
    Thanks again guys!

+ 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