+ Reply to Thread
Results 1 to 7 of 7

If, and & or in excel

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    If, and & or in excel

    Hi, I'm trying to write a formula and I'm unsure of the syntax, can someone help please?

    I need to write a formula so that

    If C2=C3 and K2=K3 then O2 & O3 will have the word "Credit" in the cell.

    I've written =IF(AND(C2=C3,K2=K3),"Credit") but I'm not getting the result I want in O3, that is coming up false, so I think I need to add an OR condition, but brain has failed.

    Any help greatly appreciated.

    Thanks

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

    Re: If, and & or in excel

    Hi
    Your formula looks fine to me. If either of your statements are incorrect you will get a FALSE result. If both criteria must evaluate to TRUE then you don't need an OR statement. You could check that the formatting for all cells are the same which may be giving you your error.
    Hope this helps.
    Good luck.
    Tony

  3. #3
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: If, and & or in excel

    Hi

    it means either C2 is not equal to C3 or K2 is not equal to K3

    use below formula you will get blank cell in case above criteria doesn't match

    =IF(AND(C2=C3,K2=K3),"Credit","")
    Click on * below if you find this helpful

    Thanks,
    A

  4. #4
    Registered User
    Join Date
    08-08-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: If, and & or in excel

    Problem is when I copy the formula down to O3, it's looking at row 4 and I still need it to look at row 3.

    So the O3 formula needs to be:

    =IF(AND(C3=C2,K3=K2),"Credit")

    I need a combination of both formula so I can copy it down and get the result in O2 & O3

  5. #5
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: If, and & or in excel

    in that case use below

    =IF(AND($C$2=$C$3,$K$2=$K$3),"Credit","")

    $ sign locks the movement of cell / column references, when its copied vertical or horizontally

  6. #6
    Registered User
    Join Date
    08-08-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: If, and & or in excel

    But I'm not locking C2 and C3 permanently, I want the formula to look up and down across a pair of rows if that makes sense?

    If C67=C68 and K67=K68 then I need both O67 and O68 to say "credit" and a formula I can copy down in O, I have about 500 rows of data

  7. #7
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: If, and & or in excel

    ok....

    in that case below formula in o2

    =IF(AND(C2=C3,K2=K3),"Credit","")

    and below in O3

    =O2

    then Select both O2 & O3 and copy down across

    i hope this will solve your problem

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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