+ Reply to Thread
Results 1 to 15 of 15

Sort numbers

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Sort numbers

    I have a sequence of numbers of which some of them repeat , so I used the countif function to list how many times each number repeats if exists in the sequence. Now I want to group them(in a table) so the numbers that never occur in the sequence will be listed under 0, numbers that come up once under 1 and so on. i.e numbers : 1,2,3,4,5,6,7,8,9 ; sequence 2,3,5,3,3,7,8,6,7,5,7,5,8. So we have 1 and 9 should be listed under 0; 2,6 under 1; 8 under 2 and 3,5,7 under 3.

  2. #2
    Forum Contributor
    Join Date
    03-11-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    379

    Re: Sort numbers

    Hi,

    Welcome to the forum!

    I suggest you to post a sample file with the output you want.

    This practice makes life easier for the other users to understand the question better.

    Regards,
    AM

  3. #3
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Hi,

    Hope this helps.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort numbers

    With 2 helpcolumns and after that index / match.

    See the attached file.

    The result is in the green cells.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Registered User
    Join Date
    01-07-2015
    Location
    India
    MS-Off Ver
    excel 2007
    Posts
    16

    Re: Sort numbers

    Make a pivot of Columns Number and Repeat Times and the put both under Column Labels in Pivot Table Field List

  6. #6
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Thank you oeldere!

    Wow !Nice one. I have to digest this for a little while to understand how it works, but yes this is it.
    Last edited by mihulea; 01-08-2015 at 07:53 AM.

  7. #7
    Registered User
    Join Date
    01-07-2015
    Location
    India
    MS-Off Ver
    excel 2007
    Posts
    16

    Re: Sort numbers

    It ain't exactly how you wanted it, but this is the easiest & quickest thing for any analysis...

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort numbers

    P3=countif($N$3:$N3,$N3) and dragged down
    Q3=N3&P3 and dragged down

    b21=iferror(INDEX($L$4:$Q$11,match(B$14&row()-20,$Q$4:$Q$11,0),1),"")

    dragged down and to the right.

    Explaination:

    b21 iferror(formula,"")
    if the formula is wrong => return an empty cell.

    b21 row()-20 returns => row 21 -20 = 1
    b22 with the same formula returns => row 22 - 20 = 2

    b14 = 0 so this part B$14&row()-20 returns => 01

    The index / match formula looks for the value 01 (see the explaination above) in column Q and returns the value on the same row in column L (in which is 9).

    I hope I explained the trickey parts well enough.

    If not just ask.
    Last edited by oeldere; 01-08-2015 at 08:09 AM.

  9. #9
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Quote Originally Posted by oeldere View Post
    With 2 helpcolumns and after that index / match.

    See the attached file.

    The result is in the green cells.
    =IFERROR(INDEX($L$4:$Q$11,MATCH(B$14&ROW()-20,$Q$4:$Q$11,0),1),"")

    In the above why did you start from L4 and Q4 ?

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort numbers

    @mihulea

    That is a very good catch.

    The earlier formula is wrong. it has to be like below.

    See in the changed attached file.

    In the earlier file it did not go wrong (excedently), since there where no values with 1 hit.

    Sorry for the unconviency.

    The formula should be =IFERROR(INDEX($L$3:$Q$11,MATCH(B$14&ROW()-20,$Q$3:$Q$11,0),1),"")

  11. #11
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Quote Originally Posted by oeldere View Post
    @mihulea

    That is a very good catch.

    The earlier formula is wrong. it has to be like below.

    See in the changed attached file.

    In the earlier file it did not go wrong (excedently), since there where no values with 1 hit.

    Sorry for the unconviency.

    The formula should be =IFERROR(INDEX($L$3:$Q$11,MATCH(B$14&ROW()-20,$Q$3:$Q$11,0),1),"")
    Im doing something wrong. In blue is what I did, but I get no values????

  12. #12
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Quote Originally Posted by oeldere View Post
    @mihulea

    That is a very good catch.

    The earlier formula is wrong. it has to be like below.

    See in the changed attached file.

    In the earlier file it did not go wrong (excedently), since there where no values with 1 hit.

    Sorry for the unconviency.

    The formula should be =IFERROR(INDEX($L$3:$Q$11,MATCH(B$14&ROW()-20,$Q$3:$Q$11,0),1),"")
    Got it!!! Dont mind my previous message.I used 20 for row instead of 28!

  13. #13
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort numbers

    b29 =IFERROR(INDEX($L$3:$Q$11,MATCH(B$14&ROW()-28,$Q$3:$Q$11,0),1),"")

    since you start in row 29 you have to abstract 29 - 28 (to get the wanted result 1).

    your formula gave the result 29 - 20 = 9.

    Hope I explained well enough.

  14. #14
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin,ireland
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sort numbers

    Quote Originally Posted by oeldere View Post
    b29 =IFERROR(INDEX($L$3:$Q$11,MATCH(B$14&ROW()-28,$Q$3:$Q$11,0),1),"")

    since you start in row 29 you have to abstract 29 - 28 (to get the wanted result 1).

    your formula gave the result 29 - 20 = 9.

    Hope I explained well enough.
    You are a genius. I cant say anymore!

  15. #15
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort numbers

    Thanks for the nice compliment.

    Hope you understand where it get wrong, so you can amend the formula for future use.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How do you sort item numbers targeting only specific numbers?
    By matt323 in forum Excel General
    Replies: 10
    Last Post: 12-29-2013, 01:15 AM
  2. Replies: 1
    Last Post: 12-28-2013, 11:46 PM
  3. [SOLVED] sort using vba want to sort text-as-numbers
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2013, 11:46 AM
  4. Sort by numbers like 1.1.2....
    By zamehan in forum Excel General
    Replies: 7
    Last Post: 11-30-2012, 10:30 AM
  5. [SOLVED] How to merge a numbers from 3 cells, eliminate repetitive numbers, and sort such numbers?
    By david gonzalez in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2012, 11:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1