Excel formula

Occasional Contributor


I have a column with 66 entries of different areas of m2. How can I sort these into 5 groups, ie. under 100, 100-500, 500-1000,1000-10,000, 10,000+. Thanks

13 Replies


Let's say the entries begin in A2.

In another cell in row 2, enter the formula


=LOOKUP(A2,{0,100,500,1000,10000},{"under 100","100-500","500-1000","1000-10,000","10,000+"})


This can be filled down.

@Hans Vogelaar Thanks, so clever, that worked by spilling over the range each cell falls into, but gives me 67 results of each range. Can I now find out how many are in each of the 5 ranges? Thanks

best response confirmed by StevieBrett (Occasional Contributor)


You could create a pivot table based on the data.

Add the new column to both the Rows area and the Values area.


Or use formulas such as


=COUNTIFS(A2:A67, "<100")

=COUNTIFS(A2:A67, ">=100", A2:A67, "<500")

=COUNTIFS(A2:A67, ">=500", A2:A67, "<1000")

=COUNTIFS(A2:A67, ">=1000", A2:A67, "<10000")

=COUNTIFS(A2:A67, ">=10000")

You’re a genius, that worked a treat, thank you. Tired eyes now but I may well have a few questions about comparing data later. Where did you learn all this? Thanks, your help is much appreciated


I've been using Excel for over 30 years now, so I have a lot of experience. And I learned a lot from all the talented people who help others on forums like this!

Hi Hans, you’re my go to guru now! I have a spreadsheet open, columns go up to BE, I have at least 70 entries for the rows. Apart from reducing the viewing size (now 42 %) how can I see the column headings in row 1 to keep entering the data in the lower rows (hope that makes sense!)


Activate the View tab of the ribbon.

In the Window group, select Freeze Panes > Freeze Top Row.

Wow, easy as that! But that was just a warm up. So this spreadsheet is results from a survey. To compare different columns b,c,d,e,f are types of gardens (private, charity etc.), column AE is do they use herbicide (Y or N) How do I work out which how many of each garden type uses herbicide (Y) or doesn’t (N). I guess I just use this formulae then for any other comparisons throughout the sheet to generate graphs? Thanks


Could you attach a small sample workbook without sensitive/proprietary information?

@Hans Vogelaar I’ve sent a basic form of what I’m trying to do, so the type of garden is shown with a 1, herbicide use with a y or n. 


See the attached version.

The second sheet has formulas and a chart.

I also added an alternative layout to the first sheet, and a pivot table based on this layout.

@Hans Vogelaar that’s brilliant, thanks. So it should be possible to compare any of the variables, so private that have cobbles and use herbicide? Sorry to have taken up so much of your time, I really appreciate your help!



See the attached version. You can select a variable in A2 and in B2 on Sheet2, and C2 will display the count. The result will only be meaningful for variables (columns) that contain numbers, not for columns that contain text.

If you want to be able to count the latter too, you'd need to change the layout to one that is suitable for creating a pivot table - see the example in my previous reply. Pivot tables are very flexible.