Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation Field Help Needed 1

Status
Not open for further replies.

otakar

Technical User
Feb 15, 2007
1
0
0
AT
I have a Calculation field "A" which is already a SUM of several number fields. I would like to compare the field "A" with another field "B". And if field "A" is smaller then field "B", I would like to have the number in field "A" display in RED. If "A" is larger than "B" then it needs to be in GREEN color.
How would you write such a calculation, please ? And how to add it to the existing SUM calculation ?
Thank you in advance from a "newbie" !
 
Try this:

Case (

field_a ? field_b; field_a;
field_a < field_b; TextColor ( field_a; RGB ( 255; 0; 0 ) )

)


 
Sorry, didn't read your post completely. Try this instead ...

Call this calculation field "c_field_a" and

Case (

Sum ( numb_field1;numb_field2;numb_field3 ) ? field_b; TextColor ( Sum ( numb_field1;numb_field2;numb_field3 ); RGB ( 0; 255; 0) );
Sum ( numb_field1;numb_field2;numb_field3 ) < field_b; TextColor ( Sum ( numb_field1;numb_field2;numb_field3 ); RGB ( 255; 0; 0) )

)


 
Apparently I can't get out of my own way tonight ... one more time from the top ...

Case (

Sum ( numb_field1;numb_field2;numb_field3 ) = field_b; Sum ( numb_field1;numb_field2;numb_field3 );

Sum ( numb_field1;numb_field2;numb_field3 ) > field_b; TextColor ( Sum ( numb_field1;numb_field2;numb_field3 ); RGB ( 0; 255; 0) );

Sum ( numb_field1;numb_field2;numb_field3 ) < field_b; TextColor ( Sum ( numb_field1;numb_field2;numb_field3 ); RGB ( 255; 0; 0) )

)

This assumes that you want the color to be the default black if the values in field a and field b are the same.

You could also avoid typing those annoying sum fields over and over again by using the Let function.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top