# SolvedGrouping Numbers with formulas or Pivot Excel

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

#### ranger1

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.

#### Attachments

• 14.2 KB Views: 1
Last edited:

#### Marius44

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("F5 14").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

#### Attachments

• 23.7 KB Views: 2

#### ranger1

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("F5 14").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

Wow, quite a solution. Thank you.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.