Forum Moderators: phranque

Message Too Old, No Replies

getting percentages from raw data

Excel, SQL, or other text munging help needed

         

jamesa

12:37 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a rather long list of, say, names and the cities they live in. All the names are unique. The question I need to answer is what percentage of people on the list live in each city (i.e.- Baltimore=26%, Miami=19%, etc). What's the easiest way to compute this? Right now the data is in a text file but I can easily pop it into excel or a database.

jamesa

2:43 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the SQL answer:

select name, city, count(*)/total from poll group by city;
where total was previously computed by doing
select count(*) from poll

Anyone know a way to do this in Excel or am I going to have to find that out for myself as well? :p

Mardi_Gras

2:52 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could easily total the names per city in Excel by using a pivot table - then calculating the percentages will be easy.

jamesa

6:09 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, Mardi_Gras. Gives me something to look into.

killroy

9:20 am on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



in EXCEL, I'd simply place MAX(range) in a cell, give it a label, and then place =cell/total*100

in a column next tothe results of hte subtotals.

SN