Making a Yes No field add up to a positive number

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

Guest

I have Yes No fields. When I add up the yes's they are negative....So how do
I get it to do 1 and zero instead of the default -1 and zero.
-1 = Yes by default.

Thanks in advance!
 
Replace
=Sum([MyYesNoField])
with:
=Abs(Sum([MyYesNoField]))

Or just use a minus sign.
 
Just multiply your sum by -1. If your sum is -50, then multiplying it
by -1 will give you positive 50.


Rick B
 
Hi, Ken.
So how do
I get it to do 1 and zero instead of the default -1 and zero.

You need to use the absoulute value in order to force a positive value
instead of the default negative value. I don't know how you need to apply
the equation, but if you are using it in a query then one way to do it would
be:

SELECT SUM(ABS(IsCorrect)) As Answers
FROM MyTable;

If five records consist of four TRUE values, then the sum (Answers, in this
case) would equal 4, not -4.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top