• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1883
  • Last Modified:

How to sum a formula field

I am trying to sum a formula field.  I have a formula called I/D and it uses an if statement to to see if a pre-test grade is higher than the post test.  If it is higher, it gives it a 1 else 0.  The sum is having problems with the I/D field saying 'A number field or currency amount field is required here.'  Any idea's would help very much.
0
a23m2000
Asked:
a23m2000
  • 5
  • 4
1 Solution
 
frodomanCommented:
Sounds like a problem with your formula.  It should look like this:

If {Pre-Test} > {Post-Test} Then
   1
Else
   0

And both pre-test and post-test must be numeric values, of course.  If there are null values in either pre or post that will cause you a problem also.

If this doesn't help, please post your I/D formula.
0
 
frodomanCommented:
By the way, if you do have null values you'd address it this way:

If isnull({Pre-Test}) or isnull({Post-Test}) Then
   0
Else if {Pre-Test} > {Post-Test} Then
   1
Else
   0
0
 
a23m2000Author Commented:
There isn't a problem with the I/D field in itself it spits out the number 1 or 0 based upon the >< of the grades...where I am running into problems is when I am trying to create another field to sum the I/D field....example...

                Pretest         Posttest        I/D
Student 1       50              45              0
Student 2       50              95              1
Student 3       50              45              0

Class Average:  50              62



# of participants increasing score              2                <------------------ This is where I am having the problem.
# of participants decreasing score      1                       <------------------ Here as well.


So the I/D field is good, however when I try and create a formula for the # of participants increasing and decreasing I have the problem.  Hopefully this helps clarify the problem.

Sum ({@I/D}) is what I'm doing for the # of participants increasing score.  However I get the error 'A number field or currency amount field is required here.'
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
frodomanCommented:
I understand what you're saying but I suspect that the number you're seeing in the I/D column isn't really a number...  

If I create a summary formula as: Sum ({@I/D}) I get the correct result.  You're being told that a number is required here which means that your formula I/D does not always return a number.  Most likely it is either returning a text "1" or "0" or is sometimes returning a null value.

Please post your I/D formula and I'll take a look.
0
 
a23m2000Author Commented:
If {COURSE_HISTORIES.rt_ch_grade} > {COURSE_HISTORIES.rt_ch_test} then '1' else '0'

I see what you are saying about the text part, I am looking at it now.
0
 
frodomanCommented:
Just take the single-quotes off your formula & you should be fine:

   If {COURSE_HISTORIES.rt_ch_grade} > {COURSE_HISTORIES.rt_ch_test} then 1 else 0

0
 
a23m2000Author Commented:
great that does it...one more question...on the I/D field there are 1's and 0's and can I use a formula or summary to find the number of particiants decreasing score, or the number of 0's on the I/D field....thanks...I will award you the points after this question...

thanks again for you help
0
 
frodomanCommented:
Easiest answer based on what you have is another formula:

count({@I/D}) - sum({@I/D})

This just counts the entries and subtracts the sum (which is the same as subtracting the number of '1's).

If you want to get more adventurous, you can look into using 'count' with conditions.  

Another option would be to have another version of your I/D field with the reversed criteria (so the 1's & 0's are reversed) and just create another sum on those.

I'd go with the formula above in this case, but remember the other options for another time when you have more than 2 possible outcomes...
0
 
a23m2000Author Commented:
Hey I really appriciate your help, I will award your points, thanks again buddy
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now