I have a textbox with a value like this:
="The average score is: " & 100/9.5 & " points."
I've tried all different conversion functions I can think of but with no
result.
/PeterPeter Larsson wrote:
> I have a textbox with a value like this:
> ="The average score is: " & 100/9.5 & " points."
> I've tried all different conversion functions I can think of but with no
> result.
> /Peter
Try this:
="The average score is: " & FormatNumber(100/9.5,2) & " points."
The second argument (2) returns the number of digits past the decimal.|||Michael, thanks for replying!
Your suggestion works fine (="The average score is: " & 100/9.5 & "
points." I simplified the calculation in my original posting.
Now I have the number of decimals correct, but still only an integer
value like 1.00
The thing is that I use this in a footer row of a table, it looks
exactly like this:
="The average score is: " &
FormatNumber(SUM(Fields!Score.Value*Fields!Exp.Value)/First(Fields!Count,"NumberOfPlayers"),2)
& " points."
The values left of the \ sign is from the table dataset itself, the
NumberOfPlayers dataset is not.
I guess I have to some conversion in the expression, but I can't find
the correct function. :(
ANy ideas?
Best regards,
Peter Larsson!
Michael wrote:
> Peter Larsson wrote:
>> I have a textbox with a value like this:
>> ="The average score is: " & 100/9.5 & " points."
>> I've tried all different conversion functions I can think of but with
>> no result.
>> /Peter
> Try this:
> ="The average score is: " & FormatNumber(100/9.5,2) & " points."
> The second argument (2) returns the number of digits past the decimal.|||On Feb 11, 9:47=A0am, Peter Larsson <scape...@.hotmail.com> wrote:
> Michael, thanks for replying!
> Your suggestion works fine (=3D"The average score is: " & 100/9.5 & "
> points." I simplified the calculation in my original posting.
> Now I have the number of decimals correct, but still only an integer
> value like 1.00
> The thing is that I use this in a footer row of a table, it looks
> exactly like this:
> =3D"The average score is: " &
> FormatNumber(SUM(Fields!Score.Value*Fields!Exp.Value)/First(Fields!Count,"=N=ADumberOfPlayers"),2)
> & " points."
> The values left of the \ sign is from the table dataset itself, the
> NumberOfPlayers dataset is not.
> I guess I have to some conversion in the expression, but I can't find
> the correct function. :(
> ANy ideas?
> Best regards,
> Peter Larsson!
>
> Michael wrote:
> > Peter Larsson wrote:
> >> I have a textbox with a value like this:
> >> =3D"The average score is: " & 100/9.5 & " points."
> >> I've tried all different conversion functions I can think of but with
> >> no =A0 result.
> >> /Peter
> > Try this:
> > =3D"The average score is: " & FormatNumber(100/9.5,2) & " points."
> > The second argument (2) returns the number of digits past the decimal.- =Hide quoted text -
> - Show quoted text -
I would make sure that the Data returned is a Floating point number,
and not Integer somewhere along the line. For example, your
denominator First(Fields!Count.Value) may actually be returning an
Integer (since Counts are typically whole numbers) and thus dividing
by an Integer is an Integer, which have no decimal places, hense the
"1.000"
=3D"The average score is: " &
Format( Sum(Fields!Score.Value * Fields!Exp.Value )
/ CDbl(First(Fields!Count.Value,"N=ADumberOfPlayers")), "0.00" ) & "
points."
-- Scott|||Orne wrote:
> On Feb 11, 9:47 am, Peter Larsson <scape...@.hotmail.com> wrote:
>> Michael, thanks for replying!
>> Your suggestion works fine (="The average score is: " & 100/9.5 & "
>> points." I simplified the calculation in my original posting.
>> Now I have the number of decimals correct, but still only an integer
>> value like 1.00
>> The thing is that I use this in a footer row of a table, it looks
>> exactly like this:
>> ="The average score is: " &
>> FormatNumber(SUM(Fields!Score.Value*Fields!Exp.Value)/First(Fields!Count,"NumberOfPlayers"),2)
>> & " points."
>> The values left of the \ sign is from the table dataset itself, the
>> NumberOfPlayers dataset is not.
>> I guess I have to some conversion in the expression, but I can't find
>> the correct function. :(
>> ANy ideas?
>> Best regards,
>> Peter Larsson!
>>
>> Michael wrote:
>> Peter Larsson wrote:
>> I have a textbox with a value like this:
>> ="The average score is: " & 100/9.5 & " points."
>> I've tried all different conversion functions I can think of but with
>> no result.
>> /Peter
>> Try this:
>> ="The average score is: " & FormatNumber(100/9.5,2) & " points."
>> The second argument (2) returns the number of digits past the decimal.- Hide quoted text -
>> - Show quoted text -
> I would make sure that the Data returned is a Floating point number,
> and not Integer somewhere along the line. For example, your
> denominator First(Fields!Count.Value) may actually be returning an
> Integer (since Counts are typically whole numbers) and thus dividing
> by an Integer is an Integer, which have no decimal places, hense the
> "1.000"
> ="The average score is: " &
> Format( Sum(Fields!Score.Value * Fields!Exp.Value )
> / CDbl(First(Fields!Count.Value,"NumberOfPlayers")), "0.00" ) & "
> points."
> -- Scott
Hi Scott,
Well, now it suddenly works, in the following format
formatnumber((val1*val2)/val3,2) without any conversion to double, all
numbers are integer. This is really strange because I tried it many times.
I just hate when stuff just suddenly start working again, and you have
no clue what was wrong.
Thanks for helping though. :)
Regards,
Peter Larsson!
Sunday, March 11, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment