<> or NOT?

  • Thread starter Thread starter mlv
  • Start date Start date
M

mlv

Hi

Is there any difference in functionality between the following two formulae,
and if so, when would you use one in preference to the other?

=(A1<>"")

=(NOT(A1=""))

Thanks
 
Both give the same result.

But NOT can also negate a more complex expression like A1<>"" AND B2> 3

Personally, I don't like the <> operator. This is because I have a background in the programming language COBOL. In COBOL you had
(have?) the NOT keyword to negate the result of a comparison and you had the NOT IS operator (one operator, consisting of two
"words") which had the same meaning as the <> operator in VBA. And of course there was rhea IS operator.
Here you can get problems in some languages. My native language is Dutch, and it is quite common to say (in Dutch) "If the code is
not equal to 1 or 2 then do something". Many programmers translated this into
IF CODE NOT IS 1 OR 2 THEN......
Of course the code is always unequal to at least one of the two so the answer would always be TRUE.

This may be experienced differently in other languages, I don't know.

But I see no good reason for having a "not equal" operator and I don't like operators of more than one character or word, if those
words or characters also have a meaning if used on their own.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Hi
|
| Is there any difference in functionality between the following two formulae,
| and if so, when would you use one in preference to the other?
|
| =(A1<>"")
|
| =(NOT(A1=""))
|
| Thanks
| --
| Mike
| -Please remove 'safetycatch' from email address before firing off your
| reply-
|
|
 
There appears to be no diff except that you don't need the extra ( ) for
either

You may want to try this to account for the "dreaded space bar"
=TRIM(A1)<>""
 
<and you had the NOT IS operator >

I should add, in the COBOL dialect we used (ICL 1900)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Both give the same result.
|
| But NOT can also negate a more complex expression like A1<>"" AND B2> 3
|
| Personally, I don't like the <> operator. This is because I have a background in the programming language COBOL. In COBOL you
had
| (have?) the NOT keyword to negate the result of a comparison and you had the NOT IS operator (one operator, consisting of two
| "words") which had the same meaning as the <> operator in VBA. And of course there was rhea IS operator.
| Here you can get problems in some languages. My native language is Dutch, and it is quite common to say (in Dutch) "If the code
is
| not equal to 1 or 2 then do something". Many programmers translated this into
| IF CODE NOT IS 1 OR 2 THEN......
| Of course the code is always unequal to at least one of the two so the answer would always be TRUE.
|
| This may be experienced differently in other languages, I don't know.
|
| But I see no good reason for having a "not equal" operator and I don't like operators of more than one character or word, if
those
| words or characters also have a meaning if used on their own.
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
|| Hi
||
|| Is there any difference in functionality between the following two formulae,
|| and if so, when would you use one in preference to the other?
||
|| =(A1<>"")
||
|| =(NOT(A1=""))
||
|| Thanks
|| --
|| Mike
|| -Please remove 'safetycatch' from email address before firing off your
|| reply-
||
||
|
|
 
<A1<>"" AND B2> 3>

That's in VBA. In a worksheet it would be

=NOT(AND(A1<>"",B2>3))

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| Both give the same result.
|
| But NOT can also negate a more complex expression like A1<>"" AND B2> 3
|
| Personally, I don't like the <> operator. This is because I have a background in the programming language COBOL. In COBOL you
had
| (have?) the NOT keyword to negate the result of a comparison and you had the NOT IS operator (one operator, consisting of two
| "words") which had the same meaning as the <> operator in VBA. And of course there was rhea IS operator.
| Here you can get problems in some languages. My native language is Dutch, and it is quite common to say (in Dutch) "If the code
is
| not equal to 1 or 2 then do something". Many programmers translated this into
| IF CODE NOT IS 1 OR 2 THEN......
| Of course the code is always unequal to at least one of the two so the answer would always be TRUE.
|
| This may be experienced differently in other languages, I don't know.
|
| But I see no good reason for having a "not equal" operator and I don't like operators of more than one character or word, if
those
| words or characters also have a meaning if used on their own.
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
|| Hi
||
|| Is there any difference in functionality between the following two formulae,
|| and if so, when would you use one in preference to the other?
||
|| =(A1<>"")
||
|| =(NOT(A1=""))
||
|| Thanks
|| --
|| Mike
|| -Please remove 'safetycatch' from email address before firing off your
|| reply-
||
||
|
|
 
You missed one....

=LEN(A1)>0

As for differences... the NOT and LEN ones require a function call whereas
the <> one doesn't... there may be an cost involved in calling the functions
that doesn't exist in the <> formula (which might matter if you have a large
number of formulas doing performing this functionality).

Rick
 
Another option might be:
=ISBLANK(A1)

However, if A1 has only the prefix character '
then =ISBLANK(A1) returns False
and =A1="" returns True.

Just something to keep in mind...
- -
Dana Delouis
 
I said:
Is there any difference in functionality between the following two
formulae, and if so, when would you use one in preference
to the other?

=(A1<>"")

=(NOT(A1=""))

Thanks for all the useful information.
 
Back
Top