# Solved Grouping Numbers with formulas or Pivot Excel

Discussion in 'Business Applications' started by ranger1, Apr 7, 2019.

Joined:
Jul 10, 2007
Messages:
111
I have a list of ten numbers from 1 to 100 in column A.

I need to group them into 10 sets - 1-10, 11-20, ..., 90-100.

I was able to do that with Pivot tables but the groupings are not too clear for presentation.
With if formula, the list is not consecutive. There are blanks that look untidy.

Is it possible to to search in a range of numbers and create lists based on a criteria.
The lists should be presented in columns.

EG.

A B C D E F G H I J K
1| M 0-10 11-20 21-30 30-40 40-49 50-60 61-70 71-80 81-90 91-10
2| 50 0 15 46 50 64 73 83 90
3| 95 49 95
4| 73
5| 46
6| 15
7| 0
8| 49
9| 90
10| 64
11| 83

Column A is the main list.
Thank you.

Edit: I just attached what I have done so far.
So many blank cell make it look disorganised.

#### Attached Files:

• ###### test.xlsx
File size:
14.2 KB
Views:
1
Last edited: Apr 7, 2019
2. ### Marius44

Joined:
Nov 29, 2018
Messages:
1
Hi
Excuse my english (I'm italian)
I think it is possible with VBA (below the code)

Option Explicit

Sub notes()
Dim ur As Long, i As Long, r As Long, c As Long
Range("F514").ClearContents
ur = Cells(Rows.Count, 1).End(xlUp).Row
ReDim arr(1 To ur, 1 To 2)
arr() = Range(Cells(5, 2), Cells(ur, 3))
For i = 1 To UBound(arr)
If arr(i, 2) > 90 And arr(i, 2) <= 100 Then
r = 5
ElseIf arr(i, 2) > 80 And arr(i, 2) <= 89 Then
r = 6
ElseIf arr(i, 2) > 70 And arr(i, 2) <= 79 Then
r = 7
ElseIf arr(i, 2) > 60 And arr(i, 2) <= 69 Then
r = 8
ElseIf arr(i, 2) > 50 And arr(i, 2) <= 59 Then
r = 9
ElseIf arr(i, 2) > 40 And arr(i, 2) <= 49 Then
r = 10
ElseIf arr(i, 2) > 30 And arr(i, 2) <= 39 Then
r = 11
ElseIf arr(i, 2) > 20 And arr(i, 2) <= 29 Then
r = 12
ElseIf arr(i, 2) > 10 And arr(i, 2) <= 19 Then
r = 13
ElseIf arr(i, 2) <= 9 Then
r = 14
End If
c = Cells(r, Columns.Count).End(xlToLeft).Column + 1
Cells(r, c) = arr(i, 1)
c = c + 1
Cells(r, c) = arr(i, 2)
Next i
End Sub

You will find my file
Bye,
Mario

PS this is not a toungue but Range("F5 : p 14").ClearContents

#### Attached Files:

• ###### test-Marius.xlsm
File size:
23.7 KB
Views:
2

Joined:
Jul 10, 2007
Messages:
111

Wow, quite a solution. Thank you.

As Seen On