Problems with signs

Guys I have a problem. I have two currency variables, A and B.
But when I do some calculations the displayed value is net, I don’t get the comma. Ex: A=10 B=5 A-B=5 OK.

A=5 B=10 A-B=5 and not -5… how to solve it?

Can you paste the code that you use?
Maybe you are using format and not defining - sign?

1 Like

Value.text=format(Ctype(a1 - b1, currency),“#.00”)

i have just read a solution:

Value.text=format(Ctype(a1 - b1, currency),“-#.00”)

if value is negative - is visible otherwise no.

it’s correct ?

Yes. That is what I tried to say above with the “- sign”.

Ok, thanks

1 Like

The format string has three parts separated by ; Try a format string of “#.00;-#.00;Zero” & see what you get.

Close, but the third option should be \Z\e\r\o as they are literals and need to be escaped.

I read the docs and I understand that you only escape what can be used in format, for example if you want to always show - then you need to escape it -.

Maybe the docs needs an update:

Displays the character that follows the backslash. Use this to display a character that is also used in the formatSpec.

From reading the above I think ‘Z\ero’ should work but it doesn’t. Only e is used in the formatSpec Z,r,o are not part of it but they don’t show.

Thank you for pointing to use \Z\e\r\o