+ Reply to Thread
Results 1 to 15 of 15

Request = generate all formations from 000 to 999 In ascending order from smallest to larg

  1. #1
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Request = generate all formations from 000 to 999 In ascending order from smallest to larg

    Request = generate all formations from 000 to 999
    In ascending order from smallest to largest.
    Example =
    234 = yes
    459 = no
    789 = yes
    Another example = 889 = no, can not have digit repeat
    The zero will be the smallest digit
    Example = 023 = yes

  2. #2
    Registered User
    Join Date
    05-20-2017
    Location
    Saint Louis, USA
    MS-Off Ver
    2016 PC, 2016 Mac
    Posts
    6

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    This seems to work. *edited with code tags*

    Please Login or Register  to view this content.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    This is not nearly enough information. You are going to have to give the rules for when a number is "yes" and when it is "no".
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Your explanation is always rough and confusing....
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    sorry =459= yes.

  6. #6
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    error=
    Sub SomeRandomRequest()

  7. #7
    Registered User
    Join Date
    05-20-2017
    Location
    Saint Louis, USA
    MS-Off Ver
    2016 PC, 2016 Mac
    Posts
    6

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Quote Originally Posted by jorel View Post
    error=
    Sub SomeRandomRequest()
    What was the error?

  8. #8
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    The rules = generate the formations of increasing order where the 1st digit is the smaller the 2nd digit is the middle and the 3rd digit is the largest of all example =
    269 = yes
    962 = no

  9. #9
    Registered User
    Join Date
    05-20-2017
    Location
    Saint Louis, USA
    MS-Off Ver
    2016 PC, 2016 Mac
    Posts
    6

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Oops. Try this. But jindon's impressive code will work as well.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    hello SPACE, error

    Sub SomeRandomRequest()

    Dim lngCounter As Long
    Dim strFormations() As String

    ReDim strFormations(0)
    For lngCounter = 12 To 999 Step 1 'start at 12 - the first ascending number (012)
    If IsAscending(CStr(lngCounter)) Then

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Please Login or Register  to view this content.

  12. #12
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Is it necessary to use VBA? I would probably use a simple combination of =AND(), LEFT(), RIGHT(), MID(), and TEXT() functions (list of functions and help files: https://support.office.com/en-us/art...6-c6d90033e188 ).

    TEXT(number,"000") will insure that the number is a text string with 3 digits (no error checking if someone enters a 4+ digit number)
    LEFT(TEXT(number,"000"),1) will return the first digit.
    MID(TEXT(number,"000"),2,1) will return the middle digit
    RIGHT(TEXT(number,"000"),1) will return the last digit
    AND(LEFT(...) < MID(...),MID(...) < RIGHT()) will return TRUE if the 3 digits are in increasing order and will return FALSE if not (assuming I thought through the logic all the way).

    There are equivalent expressions in VBA (something like IsAscending() function), if it must be VBA.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  13. #13
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Hello jindon, perfect, very good job, congratulations
    Your response was the best, it's correct.

  14. #14
    Registered User
    Join Date
    05-20-2017
    Location
    Saint Louis, USA
    MS-Off Ver
    2016 PC, 2016 Mac
    Posts
    6

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Jorel, was mine not correct because it didn't include the trailing zeros? Because my result is the same as Jindon's without those zeros.

  15. #15
    Forum Contributor
    Join Date
    11-29-2014
    Location
    brasil
    MS-Off Ver
    excel 2016
    Posts
    2,175

    Re: Request = generate all formations from 000 to 999 In ascending order from smallest to

    Okay, SPACEit was said in the rules that zero was the smallest, and that it had to cover all the formations from 000 to 999
    Jindon's answer was correct, yours is correct too.
    It's just filtering,
    Your work is also correct, thank you.

+ 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] Generate random formations, but without repeating the letters in the columns and in the ro
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-13-2017, 01:15 PM
  2. Formations of 6 digits in ascending order
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-28-2014, 02:11 PM
  3. Ascending Order
    By isaackoh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-26-2014, 10:59 AM
  4. [SOLVED] Generate "ascending order no" for columns of data that are not in order
    By abreichenbach in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-20-2013, 02:22 AM
  5. Generate Smallest list from 2 columns.
    By nnofs179 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-09-2013, 06:59 PM
  6. ascending order
    By cbian in forum Excel General
    Replies: 2
    Last Post: 06-05-2008, 07:26 AM
  7. Ascending order and IF
    By kookinuttz in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-07-2007, 08:27 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