+ Reply to Thread
Results 1 to 3 of 3

Using "Not" and "And" within if/countif

Hybrid View

  1. #1
    Registered User
    Join Date
    10-27-2010
    Location
    New York, NY
    MS-Off Ver
    Excel 2007
    Posts
    2

    Using "Not" and "And" within if/countif

    Hi,

    I have 4 cells of data, v4, w4, x4, y4. I want to write a formula with the following logic:

    If v4=x4 AND (v4 <> w4 OR v4 <> y4), return "tError"
    Else return "OK"

    What is the correct syntax?

    Thanks,

    Aram

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Using "Not" and "And" within if/countif

    =IF(AND(V4=X4,OR(V4<>W4,V4<>Y4)),"tError","OK")

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721

    Re: Using "Not" and "And" within if/countif

    Surely the OR function

    =OR(V4<>W4,V4<>Y4)

    ....is always TRUE.....unless Y4=W4?

    Perhaps give some example values of V4, W4 , V4 and Y4 and the results you expect....
    Audere est facere

+ 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