Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting percentages out of info in dropdown menus

Status
Not open for further replies.
Dec 14, 2000
3
US
have a database that has a question like "What is your current age?". in a dropdown menu we have the answers of 14 or less,15 years old, 16 years old, 17 years old, 18 years old or older.

The person requesting the database want reports in the end that would say that:
10% picked 14 or less
25% picked 15 years old...etc

any ideas how to get to this end product.

Thanks
 
Count the total number of people who have participated in the age survey. Then count the participants who chose 14, then 15... Then simply divide each age's sum by the total number of people who have participated in the survey and either use a numeric percentage field or multiply this value by 100 (the numeric percentage field converts the decimal value to the percentage ie. 0.45 = 45%, so you don't have to multiply by 100). You can do this in a combined series of queries using Totals and write a function - depends on how many choices there are. You might want to use a query to count the total number of participants, then in a procedure have a For Loop, which loops from 0 to 100 and uses this value as an embedded SQL statement's changing parameter value ie. "...WHERE Age = " & intAge
Rob Marriott
robert_a_marriott@yahoo.com

Hire me! Full-time, contract, whatever...shhh don't let my current employer know I said that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top