Cast value as number with 2 decimal places, then be able to average

I am pulling values from a db like this

z0=formatnumber((int(rstemp.Fields.Item("q1").Value) + int(rstemp.Fields.Item("q2").Value) + int(rstemp.Fields.Item("q3").Value)  + int(rstemp.Fields.Item("q4").Value)  + int(rstemp.Fields.Item("q5").Value)  + int(rstemp.Fields.Item("q6").Value)  + int(rstemp.Fields.Item("q7").Value)  + int(rstemp.Fields.Item("q8").Value)  + int(rstemp.Fields.Item("q9").Value)) /9)

z0 then returns a value that I like such as 2.74

z1=formatnumber((int(rstemp2.Fields.Item("q1").Value) + int(rstemp2.Fields.Item("q2").Value) + int(rstemp2.Fields.Item("q3").Value)  + int(rstemp2.Fields.Item("q4").Value)) /9)

z1 then returns a value that I like such as 3.43

I need to then add them together to get 6.17
Trouble is, of course, that if I do a

response.write z1 + z2

it simply concatenates the text values and returns 2.743.43 - that's not going to work ;-)

If I do a

response.write  int(z1) + int(z2)

it returns 5

I am confused!

I need to find out how to make it return 6.17 so I can divide it by 2 and get an average.
LVL 2
Who is Participating?

Commented:
What if you use cdbl function ? like

formatnumber(cdbl(z1) + cdbl(z2))
0

Author Commented:
I tried this

formatnumber(int(z1) + int(z2))

And that returns 5.00

It stripping the value of the two decimal places but I need it to stay!
0

Commented:
try
Res = 0.0 + z1 + z2
response.write res
0

Author Commented:
both work perfectly. THANKS!!
0

Commented:
I deserve full points here, why split ?
0

Commented:
0

Author Commented:
His worked perfectly also, and it's actually less code to write.

The <b>last</b> thing that i want to do is upset someone who helps me... so how can I go about getting you more points?
0

Commented:
Post a 200 pts Q for me
0

Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.