Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Equation Miscaculation
Hi there When I put this formating to the value of TextBoxs, Code: -------------------- Gtot.Value = Format(Gtot.Value, "#,##0.000") tot.Value = Format(tot.Value, "#,##0.000") bal.Value = Format(bal.Value, "#,##0.000") -------------------- Then the result of this line is always 1 or not correct Code: -------------------- bal.Value = val(Gtot.Value) - val(tot.Value) -------------------- How can get the correct result out of equation ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486844 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Equation Miscaculation
from the immediate window:
? val("10,000") 10 ? cdbl("10,000") 10000 so you might want to use cdbl instead of Val. -- Regards, Tom Ogilvy "helmekki" wrote in message ... Hi there When I put this formating to the value of TextBoxs, Code: -------------------- Gtot.Value = Format(Gtot.Value, "#,##0.000") tot.Value = Format(tot.Value, "#,##0.000") bal.Value = Format(bal.Value, "#,##0.000") -------------------- Then the result of this line is always 1 or not correct Code: -------------------- bal.Value = val(Gtot.Value) - val(tot.Value) -------------------- How can get the correct result out of equation ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486844 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Equation Miscaculation
You don't say where these objects are, but I tried textboxes on a userform
and it worked okay. What are the objects? -- HTH RP (remove nothere from the email address if mailing direct) "helmekki" wrote in message ... Hi there When I put this formating to the value of TextBoxs, Code: -------------------- Gtot.Value = Format(Gtot.Value, "#,##0.000") tot.Value = Format(tot.Value, "#,##0.000") bal.Value = Format(bal.Value, "#,##0.000") -------------------- Then the result of this line is always 1 or not correct Code: -------------------- bal.Value = val(Gtot.Value) - val(tot.Value) -------------------- How can get the correct result out of equation ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486844 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Equation Miscaculation
Thank u very much indeed.......... cdbl solved the problem and i now understand the difference between val(10000) with format TextBox1.Value = Format(TextBox1.Value, "#,##0.000") appears as 10 and CDbl(10000) with format TextBox1.Value = Format(TextBox1.Value, "#,##0.000") appears as 10,000.000 -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486844 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with an equation | Excel Discussion (Misc queries) | |||
Equation Help | Excel Discussion (Misc queries) | |||
Equation Editor- problem when editing an equation | Excel Discussion (Misc queries) | |||
Need help with equation | Excel Discussion (Misc queries) | |||
Equation | Excel Discussion (Misc queries) |