I don't want negative numbers

hi, I have to manage the amount of liquid in a container. Our measurement systems are not very precise and it often happens that measurements are not correct to the nearest cent.

To give an example: an instrument indicates that 3 liters of "product" have been poured towards "A". System "A" declares that it has received 2.6, etc...

When the container is empty, is not possible to accept a negative value from the starting container because it must be considered empty. Waiting to receive more precise measuring devices, I need to solve this thing. 

As you know I am not an expert with expressions and in fact I am making mistakes.

Benni_0-1698488737969.png

Please tell me where I'm going wrong.
Thanks for your attention

Solved Solved
0 2 366
1 ACCEPTED SOLUTION

Hi,
You cannot write code the way you think!

If I understand you want the formula to calculate [LITRI CONTENUTI] where this is the current column.

[LITRI CONTENUTI] = [LITRI 1] - [LITRE 2] + [ LITRI RICARICATTI IN CISTERNA]

This is the total sum which should never go negative. The IF() statement works as below

IF() = IF(TRUE, THEN,ELSE)

IF( [LITRI CONTENUTI] < 1, THEN [LITRI CONTENUTI] =0, ELSE =[LITRI CONTENUTI])

So you need

IF( ([LITRI 1] - [LITRE 2] + [ LITRI RICARICATTI IN CISTERNA] < 1) , 0, [LITRI 1] -[LITRE 2] + [ LITRI RICARICATTI IN CISTERNA])

So if the sum is less than 1 it sets [LITRI CONTENUTI] to zero otherwise it accepts the sum.

Hope this is what you require!

 

View solution in original post

2 REPLIES 2

Hi,
You cannot write code the way you think!

If I understand you want the formula to calculate [LITRI CONTENUTI] where this is the current column.

[LITRI CONTENUTI] = [LITRI 1] - [LITRE 2] + [ LITRI RICARICATTI IN CISTERNA]

This is the total sum which should never go negative. The IF() statement works as below

IF() = IF(TRUE, THEN,ELSE)

IF( [LITRI CONTENUTI] < 1, THEN [LITRI CONTENUTI] =0, ELSE =[LITRI CONTENUTI])

So you need

IF( ([LITRI 1] - [LITRE 2] + [ LITRI RICARICATTI IN CISTERNA] < 1) , 0, [LITRI 1] -[LITRE 2] + [ LITRI RICARICATTI IN CISTERNA])

So if the sum is less than 1 it sets [LITRI CONTENUTI] to zero otherwise it accepts the sum.

Hope this is what you require!

 

thank you very much

Top Labels in this Space