Basic Questions

Terri

New member
Local time
Yesterday, 19:10
Joined
Sep 12, 2002
Messages
5
Abs() before Sum()

I know this is a basic question, but what does Abs before the sum function do?

Also, I want to pull data from email addresses after the @ symbol. Can't quite figure out how to do this.

Any help would be appreciated

Thanks in advance!
 
Last edited:
Basically all the Abs() function does is return the "absolute value" of a number.

If the result from your Sum() function is 125.72 The return from the Abs() function would not change ... it would be 125.72. But if the return from the Sum() function is a negative number .... such as -125.72 ... the result from the Abs() function would be 125.72 (a positive value).

HTH
RDH
 
Last edited:
I am trying to do a sales report. I have positive and negative numbers with the Abs the return is all positive numbers. How can I get it to return correctly?
 
Hi Terri,
I assume u'd want to sum the positive and negative numbers and then get the absolute value?


eg. yourfield
10
-20
-10
20
-40
-----------
sum : - 40
abs(sum) : 40

u apply the abs() after doing the sum

Hope this helps ..

Gina.
 
Looking at my data closer I have a problem. I use Access with an ODBC connection. The data comes accross backwards. So basically my sales come through as negative and discounts come through as a positive. Therefore my sum does not work correctly. HELP!!:confused:
 
Hi Terri,

Even then, your sum amount should not change .
It's only the sign that will change.

eg. sales -10, - 20, -30 Total : -60
discounts 10, 20, 40 Total : 70

Total Sum : sales + discounts : 10


sales 10, 20, 30 Total : 60
discounts - 10, -20, -40 Total : -70

Total Sum : sales + discounts : -10

you can change the sign before the sum using a multiply by -1 (assuming you have a field to distinguish your sales and discounts) or after the sum using the abs function.

Let me know if this helps.
Gina.
 
The sign is a Credit/Debit issue. From the customer's perspective a Credit is a positive number. From the company's perspective a credit is a negative number.

If you want the total to be the absolute value, use abs() as the outer function - Abs(Sum(SomeField)) - this way the +'s and -'s are added properly and the final result is shown as a positive number. If you swap the functions - Sum(Abs(YourField)) - all the numbers are converted to positive BEFORE they are summed which will of course give you an incorrect result.
 

Users who are viewing this thread

Back
Top Bottom