1. Senior Member
Join Date
Dec 1969
Posts
422

ok, here my situation:<BR>I&#039;ve made a top10 list that people can vote on.<BR><BR>I know how to get the totle number of votes, but I would like to brake it down into percentage for the amount of votes that each vote-option has in comparison with the rest.<BR><BR>I hope I explained myself well enough.<BR>any ideas on how I can do this? and if so could someone please show me an example?<BR><BR>thanks for your time!:-)<BR>

2. Senior Member
Join Date
Dec 1969
Posts
2,809

RE: some help with Math please!

Get the total number for each of the vote options. Then take each total, and divide by the total number of votes, then multiply by 100 to get the percentage. I think...

3. Senior Member
Join Date
Dec 1969
Posts
422

RE: some help with Math please!

4. Senior Member
Join Date
Dec 1969
Posts
422

RE: some help with Math please!

ok I&#039;ve got it!!!:-)<BR>but do u know how to round off to the nearest 100th?<BR><BR>like I&#039;m getting numbers like this now: 33.8983050847458 <BR>and I would like it to only be 33.8<BR>

5. God
Senior Member
Join Date
Dec 1969
Posts
18,177

RE: some help with Math please!

Round()<BR>FormatNumber()

6. Senior Member
Join Date
Dec 1969
Posts
422

RE: some help with Math please!

hmm,,,ok ,,<BR>and how would I format that into my code,,?<BR><BR>here&#039;s my code:<BR>&#060;%<BR>total2 = 0<BR>do while not rs2.eof<BR>total2 = total2 + rs2("votes")<BR>rs2.movenext<BR>loop<BR>vote_pct = vote_1*100<BR>%&#062;<BR>&#060;%<BR><BR>totel = rs("votes")/total2<BR>varPercent = totel * 100<BR><BR>%&#062;<BR>&#060;%=varPercent%&#062;<BR >

7. God
Senior Member
Join Date
Dec 1969
Posts
18,177

When you display it.

You want to format it then.

8. Senior Member
Join Date
Dec 1969
Posts
422

RE: some help with Math please!

ok, I&#039;ve got this now:<BR>&#060;%=Round(varPercent)%&#062;%<BR><BR>a nd that gives me 34%<BR>but I would like it to show 34.6%<BR><BR>how could I change this?

9. God
Senior Member
Join Date
Dec 1969
Posts
18,177

RE: some help with Math please!

Round() documentation:<BR>http://msdn.microsoft.com/library/en-us/script56/html/vsfctRound.asp<BR><BR>It takes an optional parameter of the # of fields to Round() to.

10. Senior Member
Join Date
Dec 1969
Posts
422

RE: some help with Math please!

awesome!<BR>THANKZ!!!:-)

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•