Identifying number results in expressions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".
How do I correct this?
 
Lindy said:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".


Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
I attempted that fix, all read "NONE" as though the results were less than "24"

Marshall Barton said:
Lindy said:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".


Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
Attempted that fix, all results indicated "NONE" as though the result was
less than 24

Marshall Barton said:
Lindy said:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".


Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
The results are all probably less the 24. Let's see if we
can figure out why.

I'm kind of suspicious of the minus sign in front of the
Sum(). Are you sure the Raw values are negative?

If that doesn't prove fruitful, add another text box next to
the the one we're working on and use the expression
=Sum(Raw). See if that sheds any light on the problem.
--
Marsh
MVP [MS Access]

I attempted that fix, all read "NONE" as though the results were less than "24"

Lindy said:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".
Marshall Barton said:
Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
the -sum expression is used for calculating the data and having it round up
to the next whole number if decimal points are involved.

Marshall Barton said:
The results are all probably less the 24. Let's see if we
can figure out why.

I'm kind of suspicious of the minus sign in front of the
Sum(). Are you sure the Raw values are negative?

If that doesn't prove fruitful, add another text box next to
the the one we're working on and use the expression
=Sum(Raw). See if that sheds any light on the problem.
--
Marsh
MVP [MS Access]

I attempted that fix, all read "NONE" as though the results were less than "24"

Lindy wrote:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".
Marshall Barton said:
Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
The results range from 63 to 8 using the expression as a total counter only.
When I use the same expression with the switch expression some show "PLUS"
correctly and some show "NONE" correctly. When the results of the expression
are single digit i.e. "8", or "9" it must be reading them as > "40".

Removing the (-) before "sum" showed no difference.

Marshall Barton said:
The results are all probably less the 24. Let's see if we
can figure out why.

I'm kind of suspicious of the minus sign in front of the
Sum(). Are you sure the Raw values are negative?

If that doesn't prove fruitful, add another text box next to
the the one we're working on and use the expression
=Sum(Raw). See if that sheds any light on the problem.
--
Marsh
MVP [MS Access]

I attempted that fix, all read "NONE" as though the results were less than "24"

Lindy wrote:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".
Marshall Barton said:
Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
I do not understand how taking the negative of a value can
cause any kind of rounding.

The 8 and 9 issue appears to be caused by a text comparison
when you want a numeric comparison.

It sounds like you put the quotes back. Try removing the
quotes around the numbers AND removing the minus signs in
front of the Sum()
--
Marsh
MVP [MS Access]

The results range from 63 to 8 using the expression as a total counter only.
When I use the same expression with the switch expression some show "PLUS"
correctly and some show "NONE" correctly. When the results of the expression
are single digit i.e. "8", or "9" it must be reading them as > "40".

Removing the (-) before "sum" showed no difference.

Marshall Barton said:
The results are all probably less the 24. Let's see if we
can figure out why.

I'm kind of suspicious of the minus sign in front of the
Sum(). Are you sure the Raw values are negative?

If that doesn't prove fruitful, add another text box next to
the the one we're working on and use the expression
=Sum(Raw). See if that sheds any light on the problem.

I attempted that fix, all read "NONE" as though the results were less than "24"


Lindy wrote:
Am using the following in reports to identify various categories, based upon
an accumulated total:
=Switch((-Sum([Raw]*24))>="40","super",(-Sum([Raw]*24))>="24" And
(-Sum([Raw]*24))<="39","PLUS",(-Sum([Raw]*24))<"24","NONE")
This works unless the accumulated number is a single digit, i.e. "8", "9".
It appears to read this as a number greater than or equal to "40" and prints
"SUPER" rather than less than "24" and printing "NONE".


:
Don't put numeric values in quotes.

=Switch(-Sum([Raw]*24)>=40,"super",
-Sum([Raw]*24)>=24,"PLUS", True,"NONE")
 
Back
Top