How To Change A Negative Calculated Value To Zero
Aug 25, 2006Please help.
How do i convert a negative value to zero in a Form?
:confused:
Please help.
How do i convert a negative value to zero in a Form?
:confused:
G'Day all, I am new to the forum family so please excuse any ignorance I may have in asking questions the right way.
The following at times depending on certain values creates a negative value.
WDCCFrm: [qry Areas]![Formation Value]-([qry Areas]![Formation Value]*((100/[qry Areas]![Formation_DesignLife])/100))*(DateDiff("yyyy",[BLOCK_DATA]![YEAR],Date()))
Due to the data requirements a negative value is not acceptable, it needs to be zero. The above is part of an Asset Managemnt Program and if the WDCC (Written Down Current Cost) is 0 then the item is written off. How do I change the negative value to a zero.
Any comments or suggestions would be appreciated.
Regards
Alrae1
I am completing a report. I've inserted a calculated field in the report. I'm using Access 2010. Here is an example:
=([AccessTotalsOpen]-[AccessTotalsClose])/[AccessTotalsOpen]
I get the correct answer but cannot find a way to Display/FORMAT a negative number with any of the options that I have available to me?.
Any method to format a calculated field in a report?.
I tried this example but could not get it to work. =Format( FIELD ), " 0; (0)";
I have a query that returns several calculated fields. One of them is simply derived by simple summation of the others. If this calculated field returns a negative number, I need it to show as a zero.
The only way I know how to do this is by an IIF statement :
Code:
SELECT [fld1], [fld2], [fl3], .....
IIF(([fld1]-[fld2]-fld[3])<0,0,([fld1]-[fld2]-fld[3])) AS fld4
FROM...
(The above doesn't suggest that [fld1], [fld2] etc are calculated fields - I just wrote it like that for succintness - they calculate fine, there's no issue with them...)
Is there a more efficient way of doing this? I find IIF's a bit tardy, possibly because they evaluate for both True & False eventualities, regardless of the condition, and this query is going to run against a fairly large dataset so any performance lag is going to be exacerbated.
How do you change negative number to red in a report's text box? i am thinking it is an iff statement in the control source field but running into issues.
Is there a way to change all Negative nubmers to red in a Report? That is, do i have to change all text boxes individually?
I have a report which is counting and totalling numbers, but in the numbers show as negatives - I need them to show as positives.I managed to change the total in one counting field to positive but I've forgotten how - or where I put the code....
View 8 Replies View RelatedI got Gross Income Query. But I have employees that have overtime rate as well
So I have to calculate using overtime Payment And Gross Income Separately
So I make query and in query . I write this equation
Ovetime Pay: IIf([Total Hours Worked]>[Normal Hours/week],([Total Hours Worked]-[Normal Hours/week])*[Overtime Payrate],"0")
I successfully calculate it ...
BUT IT JUST GIVE ME THE VALUE LIKE A NUMBER SUCH AS e.g. 50 ,150 but instead of that i want currency data type of that calculate field for e.g. 50 become "$ 50".
Okay so in able to do that i go to properties Sheet of the field of the query and change Format to Currency ..BUT IT DOESN'T CHANGE !!!
DATABASE PAYROLL - Copy.zip
Currently I have a calculated field in my table; however, under certain circumstances I need to change the value to another value which is not related to the calculation. I understand that the calculated fields are read only (why is that?), so I was wondering if there was any way to change values within a calculated column without actually changing the expression itself.
View 1 Replies View RelatedWhen i sort values, for some reason the negatives are at the top, followed by the highest positive values. Anyway to turn this off?
Tried google and searching these forums.
I trying to create a table where the primary key is a customerID, using the autonumber function. I would like to leave the new value setting on Random, since two people may be using database. However, I'm getting a lot of negative numbers as CustomerID's. If there a way I can limit the pool of random numbers to positive only.
View 4 Replies View RelatedI have become the default Access expert in my office... which means I know next to nothing, but more than any one else here. We have just converted an Access 2.0 (yes, really) db to Access 2000 db. It seems to function fine in most regards (all that we've tested so far) except that one autonumber in a table now gives negative numbers. It started at the same number as previously (let's say 433199), but has added a - and started counting back towards zero (-433199, -433198, etc.).
The chances of these unique numbers overlapping is slim, but I am concerned about how the negative numbers will effect other aspects of the db or our accounting system which use those distinct numbers as invoice numbers.
I would like to start at a new, positive number, but just don't know how!
I'll see if I can make this clear and concise.
I basically want to sum totals(or rather subtract totals) from groups in a report. The problem is that all my numbers are positive and need a way if possible to change some to negatives.
I have 3 categories set up e.g
Account Payable , Accounts Receivable and Non-Revenue
In the form used for input , there is a drop down box in which you select 1 of the three account types. There is second box in which you input the amount (always positive). This second box is common to all account types therefore no matter the account you input the dollar values into this second box.
Right now the report is summing all values in the group so that it's not subtracting account payable amounts from account receivable amounts...Any help would be appreciated, and hopefully it will be a simple solution. NOTE: i would like to stay away from writing or editing any code. Thanks in advance
Hello all, i have a calculation in a report that sometimes results in a negative number. is there anyway to make that negative number = 0 or equal to a specific text?
View 3 Replies View RelatedI have a query calculating the sum of checked boxes of field 'A' ('letters sent') and the sum of checked boxes of field 'B' (letters received). My sum field is counting the boxes that are checked but showing the values with a negative sign in front?? How do I correct this? Also - could I create an additional field in this query to calculate the percentage% (success rate) #B's checked/#A's checked?
View 4 Replies View RelatedI need to make a coupel of statements that display the total (sum) of negative amounts and positive amounts from a single list of results which comtains both negative and positive values. The two answers need to be displayed in the footer of a report.
View 12 Replies View RelatedSounds weird huh?
I have a salesman that has a negative "Net Flow" goal (sales goal). Others have positive goals.
His YTD Net Flows (Sales) is say...$1062 (million) and his goal is "-266 million"
Of course he is doing quite well, when I use the following code to get a % to goal I get "0" whenever there is a negative goal involved.
% to Goal: IIf([NetFlowsGoal]>0,([Total Net Flows]/[NetFlowsGoal]),0)
But it works fine if all numbers are positive as you might guess.
Any pointers would be great...Thank you
On my "timesheet" for my volunteer database, I have a textbox called HoursRemaining. It's control source is =[HoursRequired]-[HoursCompleted]
That works great. Occationally however, the volunteer will complete more hours than required. Instead of displaying a negative number, I would like HoursRemaining to display 0.
Can this be done?
Thanks
ScrmingWhisprs
Howdy Folks,
I have an equation that will often return negative numbers in an update query.
I need to be able to change any negative to zero, and update the table with that zero.
So far, all I've been able to do is ignore negatives with only positive numbers updating.
Thanks
Good morning,
We have some programmers creating text files from our mainframe. We will then import these text files into Microsoft Access. We have some negative numbers in the text files that the programmers have formatted this way for example, $100.00-. When I import the file into Access, it ignores the negative sign. I told our Lead Analyst that the programmers should format the negative numbers this way, -$100.00 in order for it to import correctly. She doesn't believe me and thinks I'm not importing the file correctly.
Does anyone have an literature on this so that I can show her so that we can move forward? Or can anyone confirm that what I'm saying is correct, it needs to be formatted with the negative sign in front of the number, not behind it.
Thank you
Code:
If Me.Text250 = BETWEEN -15 And 15 Then
Me.Label253.Visible = False
Else
Me.Label253.Visible = True
End If
Even when text250 =8 label253 is visible.
I try to modify an access 2010 template from the MS website.The problem is that the template as is programmed does not accept as input negative prices. I need to use negative prices for offering discounts on my invoices. In my country the discounts are only displayed as products with negative prices/values. We do not use % discounts.
i try to create an products with negative price and to use it as an discount on the invoice. Both the products input form and the invoice input form give me the same error : "please specify an price list that is not negative" or "please specify non zero positive prices" ( sometimes it allow me to enter but when the software try to validate the form/invoice i just entered it give me those error/messages)
I changed all the field from currency in general numbers Where do I have to change in order to remove those formatting/condition..? The template has a lot of macros.. I an not able to change those macros if there are some formatting conditions in them. If it is allowed I will post the link to the free template i use to be more conclusive..Or I can give/ upload the template I use.
the link to my data base ( dropbox)
What is the format to change the negative to a positive when:
=Sum([Field]="Novice")
Text box in report
I have a query where I have some negative numbers (f.e. -403,26) which I like to make a positive (i.e. 403,26).
How do I do this??
I have a field on my report that contains positive and negative numbers. I'm trying to find a way to Sum the column twice for two different fields (one for positive sum and the other negative) To make this easy let me give a small example with explanation of the issue I am having. 14 rows of data containing positive and negative numbers in a field called [Rooms]:
1) -1
2) 1
3) 1
4) 1
5) 1
6) 1
7) 1
8) 1
9) 1
10) 5
11) 1
12) -5
13) 1
14) 1
The positive numbers represent confirmations, the negative numbers represent cancellations. I need 2 fields to separate these. The first field's control source is Sum([Rooms]). No problem there. Access does the math and comes up with "8" confirmations which is correct. Then in the second (Cancellation field) I try something like Sum([Rooms]<0) to get the negative numbers which should add up to -7 (-1+-1+-5), but instead I get -3 because it's not summing the values, it's really returning the number of rows that has a negative number. Is there any way this can be done at the ControlSource Property of a report field? Or if I could do a "Where" clause in a ControlSource I could acheive it another way, but I don't that is possible. Is this just something I'm missing with the way I'm stucturing the ControlSource or is it not possible. Or alternatively, is there a way to separate it in the query and have a separate query field for positive and negative going into the report. I can do one or the other in the query but I can't seem to do both without showing values of each type in both query fields.
Thanks for your help!
Ok i know negative numbers can be a bugger in calculations:
Code:
Function FEV1pred(height As Double, ClientID As Double) As Double
Dim a As Double
Dim Age As Integer
Dim DOB As Date
Dim TestDate As Date
Age = DateDiff("yyyy", DOB, TestDate) + CInt(Format(DOB, "mmdd") > Format(TestDate, "mmdd"))
'In this case the clients Age is 39
a = -0.0244
'Now for the fun stuff...
FEV1pred = a
'returns -0.0244 so i know the dim a holds the neg number
FEV1pred = (a * Age)
'returns 1.708 (which is incorrect, how this calculation is reached.)
FEV1pred = (a * 39)
'returns -0.9516 (which is correct)
End Function
So something about the dimming of Age seems to be doing something to the equation but i can't work out what?
I'm converting minutes to display as HH:MM but have an issue when the number is negative. How to write this so I don't end up with a negative in front of the minutes?
Format([Variance]60,"00") & ":" & Format(([Variance] Mod 60),"00")
i.e. -193 gives me -03:-13, whereas I would like -03:13