Discussion:
MS Access Comparing 3 Values
(too old to reply)
e***@gmail.com
2014-01-07 05:08:27 UTC
Permalink
Hello all,

I need to compare 3 values in MS Access and when they are all the same it should say true, if even 1 is incorrect it should say false.

Can anyone help me with a formula?

Below is an example.

Value 1 | Value 2 | Value 3

2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False

Thanks in Advance,

Edward
John W. Vinson
2014-01-07 06:40:18 UTC
Permalink
Post by e***@gmail.com
Hello all,
I need to compare 3 values in MS Access and when they are all the same it should say true, if even 1 is incorrect it should say false.
Can anyone help me with a formula?
Below is an example.
Value 1 | Value 2 | Value 3
2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False
Thanks in Advance,
Edward
(Value1=Value2 AND Value1=Value3)
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
e***@gmail.com
2014-01-07 08:00:15 UTC
Permalink
Hey John,
Thanks for your reply! I tried this already. But then i only get the values 0 and-1
Bob Barrows
2014-01-07 11:48:54 UTC
Permalink
Post by John W. Vinson
Post by e***@gmail.com
Hello all,
I need to compare 3 values in MS Access and when they are all the
same it should say true, if even 1 is incorrect it should say false.
Can anyone help me with a formula?
Below is an example.
Value 1 | Value 2 | Value 3
2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False
Thanks in Advance,
Edward
(Value1=Value2 AND Value1=Value3)
Shouldn't that be
(Value1=Value2 AND Value2=Value3)
?
e***@gmail.com
2014-01-07 16:56:03 UTC
Permalink
Tried them both and I am still getting -1 and 0 as a result. Do I have to make another column to turn these values into true and false?
John W. Vinson
2014-01-07 18:32:02 UTC
Permalink
Post by e***@gmail.com
Tried them both and I am still getting -1 and 0 as a result. Do I have to make another column to turn these values into true and false?
-1 IS True, and 0 IS false. That's how they're stored in Access.

If you want the words "True" and "False" you can use

IIF(Value1 = Value2 AND Value2 = Value3, "True", "False")

The equality test just needs to compare either of the possible pairings. If
Value1 = Value2 and Value2 = Value3, then it is an absolute certainty that
Value1 = Value3; two things that are both equal to a third thing are equal to
each other.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
Bob Barrows
2014-01-08 20:35:25 UTC
Permalink
Post by Bob Barrows
Post by John W. Vinson
Post by e***@gmail.com
Hello all,
I need to compare 3 values in MS Access and when they are all the
same it should say true, if even 1 is incorrect it should say false.
Can anyone help me with a formula?
Below is an example.
Value 1 | Value 2 | Value 3
2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False
Thanks in Advance,
Edward
(Value1=Value2 AND Value1=Value3)
Shouldn't that be
(Value1=Value2 AND Value2=Value3)
?
Duh! Of course it doesn't matter <whacks forehead in disgust>

Loading...