Min statement

M

mmatzke

I need to get the min of two statements
=IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or
[HSIB1]<[HSIB2] Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or
[RPUA1]<[RPUA2],0.05,1)
and
=IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0)))))

You an also use a sample of
[Field1] and [Field2] to make it easier

I tried:
=Min([Field1],[Field2])
with no success, I recieved the output of [Field1], and that was more than
[Field2].
 
M

mmatzke

I found a long way to solve my problem, but I would still like to know if
Access has a min/max option outside of IIf statements and within forms. my
code that worked was:
=IIf((IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0))))))>(
IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or [HSIB1]<[HSIB2]
Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or [RPUA1]<[RPUA2],0.05,1)),(
IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or [HSIB1]<[HSIB2]
Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or
[RPUA1]<[RPUA2],0.05,1)),(IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0))))))
 
A

Allen Browne

There's no built-in function for comparing across multiple fields.

You can write a function that accepts the fields and returns the min or max.
Details here:
MinOfList(), MaxOfList(): Get the min/max of a list of values
at:
http://allenbrowne.com/func-09.html

The article also explains why Access doesn't provide this, i.e. in general,
that field structure is unnormalized.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

message
I found a long way to solve my problem, but I would still like to know if
Access has a min/max option outside of IIf statements and within forms.
my
code that worked was:
=IIf((IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0))))))>(
IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or
[HSIB1]<[HSIB2]
Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or [RPUA1]<[RPUA2],0.05,1)),(
IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or
[HSIB1]<[HSIB2]
Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or
[RPUA1]<[RPUA2],0.05,1)),(IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0))))))
--
Mark Matzke


I need to get the min of two statements
=IIf([TRPB1]<[TRPB2] Or [CDVA1]<[CDVA2] Or [HSIA1]<[HSIA2] Or
[HSIB1]<[HSIB2] Or [DIGA1]<[DIGA2] Or [DIGB1]<[DIGB2] Or
[RPUA1]<[RPUA2],0.05,1)
and
=IIf([Text47]>=0.88,0.16,IIf([Text47]>=0.85,0.11,IIf([Text47]>=0.81,0.09,IIf([Text47]>=0.76,0.07,IIf([Text47]>=0.72,0.05,0)))))

You an also use a sample of
[Field1] and [Field2] to make it easier

I tried:
=Min([Field1],[Field2])
with no success, I recieved the output of [Field1], and that was more
than
[Field2].
 
Top