# Creating quintiles in QGIS when the number of observations per row is variable

I have a list of 100s of schools (1 per row), and a variable column with the total students in each school. The number of total students in each school varies widely. I want to split the list of schools into five categories such that each category contains roughly the same number of STUDENTS; the number of schools in each group doesn't matter.

Can I do this in QGIS?

• I ended up solving this using my spreadsheet. First, I sorted the data according to the second variable I was interested in (in this case, percent of students receiving free or reduced lunch). Then I created a new column, and populated it with a cumulative total of the number of students. Then I divided the total number of students by 5: this quotient (50000) was the number of students I wanted in each category. Then I manually went through and identified my categories, using the cum. total column as my guide. Assigned each category a number in its own column, and voila. – Abijah Jan 16 '14 at 4:06

## 1 Answer

You can set a graduated style (Properties > Style). Here you have a Mode popup selector letting you choose Quantile (Equal Count). Set a number of classes (number of intervals) and press the Classify button.

• But I don't want an equal number of rows (schools) in each class -- I want an equal number of students -- the number of which varies widely among schools. – Abijah Jan 16 '14 at 3:59
• If you want the equal number of students, then set the graduated style using the student field as Quantile (equal count) mode. – Jakob Jan 17 '14 at 8:32
• This method still gives me groups with equal numbers of SCHOOLS in each group, categorized by how many students are in each school. It doesn't give me groups with equal numbers of students in each. Please see above for a strategy that solved my problem. – Abijah Jan 18 '14 at 13:57