+ Reply to Thread
Results 1 to 5 of 5

How to write an IF function for picking matching cells with a particular value?

  1. #1
    Registered User
    Join Date
    07-19-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office Professional Plus 2007
    Posts
    3

    Exclamation How to write an IF function for picking matching cells with a particular value?

    I need to compare two columns so that I get a TRUE value only if values in L (from row 3 down) equals values in S and both are equal to one, [but NOT if L3 is not equal to S3 OR if they are equal but contain a value other than One]

    eg: i need

    L S BU
    1 1 YES
    2 1 NO
    2 2 NO
    1 2 NO

    i tried =IF(L3=S3=1,"YES","NO") but this answered all cells with 'NO'


    i also tried all variations of that i could think of, as well as trying 'and', =IF((L3=1, S3=1),"YES","NO"), putting 1 in quotes like =IF(L3=S3="1") etc, but i can't seem to get this to work, please please help!!!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to write an IF function for picking matching cells with a particular value?

    You were close in your second formula

    =IF(AND(L3=1,S3=1),"YES","NO")

    "putting 1 in quotes"
    A value should only be in quotes if it is text. Since these are numbers then you simply need =1 not ="1"
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    07-19-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office Professional Plus 2007
    Posts
    3

    Re: How to write an IF function for picking matching cells with a particular value?

    OMG OMG THAT WORKED!!! Thank you so so very much!!!

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: How to write an IF function for picking matching cells with a particular value?

    AND() OR() formulas in Excel work a little different to other languages you may have come across.

    You have to specify all the conditions that need to be true for the AND() OR() formula.

    So AND(L3=1,S3=1) simply means if L3=1 AND S3=1, same format applies to OR conditions OR(L3=1,S3=1) would mean if L3=1 OR S3=1

  5. #5
    Registered User
    Join Date
    07-19-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office Professional Plus 2007
    Posts
    3

    Re: How to write an IF function for picking matching cells with a particular value?

    I see, so I can extend the same formula for more data in the same way! And the OR will come in handy too, thank you so much!!!

+ 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. Macro to write custom function into cells
    By RME26 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2016, 07:08 AM
  2. [SOLVED] SMALL() Picking Empty Cells In An Array Function
    By Billy Corman in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-04-2015, 06:37 PM
  3. Replies: 4
    Last Post: 04-19-2015, 03:52 PM
  4. Replies: 4
    Last Post: 02-16-2013, 09:34 AM
  5. [SOLVED] How do i write to cells in a function?
    By Turtleman10 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-28-2012, 11:01 AM
  6. Replies: 11
    Last Post: 08-22-2011, 12:40 PM
  7. write a function to determine if cells have names
    By andrewm in forum Excel Formulas & Functions
    Replies: 41
    Last Post: 09-06-2005, 07:05 AM

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