+ Reply to Thread
Results 1 to 7 of 7

Sorting account codes

  1. #1
    Registered User
    Join Date
    06-23-2007
    Posts
    24

    Sorting account codes

    i was wondering if it is possible to sort the following into number code or maybe hide everything but one number

    like below i would want to hide everything but the codes with 7 in them

    AA20001
    AA20002
    AA50001
    AA70001
    AB20001
    AA70002

    so all i would see after using the function/code/macro is below

    AA70001
    AA70002

    any idea's?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Depends on what your trying to do. One way is to use filter and under custom filter for contains 7.

    http://www.contextures.com/xlautofilter01.html

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Account Codes

    Hi

    It is possible to pull out the necessary data if it will always be in the same position, e.g

    Please Login or Register  to view this content.
    The reference to cells(1,4) is so that you can enter any number you want from 0-9.

    Hope it is of use

    Regards


    Jeff

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by 8RaM
    i was wondering if it is possible to sort the following into number code or maybe hide everything but one number

    like below i would want to hide everything but the codes with 7 in them

    AA20001
    AA20002
    AA50001
    AA70001
    AB20001
    AA70002

    so all i would see after using the function/code/macro is below

    AA70001
    AA70002

    any idea's?
    "rng" is a define name range (ex: $A$1:$A$6)

    =IF(ISERR(SMALL(IF(LEFT(rng,3)="AA7",ROW(INDIRECT("1:"&ROWS(rng)))),ROWS($1:1))),"",INDEX(rng,SMALL(IF(LEFT(rng,3)="AA7",ROW(INDIRECT("1:"&ROWS(rng)))),ROWS($1:1))))

    ctrl+shift+enter, not just enter
    copy down

  5. #5
    Registered User
    Join Date
    06-23-2007
    Posts
    24
    sorry maybe i didnt explain very well,

    AA70001

    the AA could be anything as its the first two letters of a persons last name could be AA to ZZ but i dont know many Mr ZZeds.

    and then theres bank defines the 7 or 2 or even 5.

    and then the 0001 defines when it was created so if Mr Arnold was first he would have AR70001 but then if Mr Argos joined in he would have AR70002.

    so it is only the 7 i want to define or sort hope this makes it abit clearer any more info just post

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by 8RaM
    sorry maybe i didnt explain very well,

    AA70001

    the AA could be anything as its the first two letters of a persons last name could be AA to ZZ but i dont know many Mr ZZeds.

    and then theres bank defines the 7 or 2 or even 5.

    and then the 0001 defines when it was created so if Mr Arnold was first he would have AR70001 but then if Mr Argos joined in he would have AR70002.

    so it is only the 7 i want to define or sort hope this makes it abit clearer any more info just post
    Try this:

    =IF(ISERR(SMALL(IF(MID(rng,3,1)="7",ROW(INDIRECT( "1:"&ROWS(rng)))),ROWS($1:1))),"",INDEX(rng,SMALL( IF(MID(rng,3,1)="7",ROW(INDIRECT("1:"&ROWS(rng))) ),ROWS($1:1))))

    ctrl+shift+enter, not just enter
    copy down

  7. #7
    Registered User
    Join Date
    06-23-2007
    Posts
    24
    i think i need a little more practice with excel only really know how to use a simple IF function and vlookup and recording a macro (not coding it) but thanks very much this will give me something to work at.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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