+ Reply to Thread
Results 1 to 50 of 50

Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

  1. #1
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For those of you who like to test your formula skills, I developed a series of games (10 in all) where you can try to come up with the shortest formula possible to complete the objective. There are 2 challenges per game. Full rules are explained within the file. I'll post my best solutions a little later. Good luck!

    (Game #8 is attached)

    Also: Please post all formulas in white font to prevent spoilers!


    Note: The challenges are targeted for advanced Excel users. They range in difficulty... but even the "easier" ones can be tricky.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    My solution for License Plates is really bothering me. I feel like there's a much better way to solve it than the brute force method that I used. Hopefully someone can figure out a trick for this one!

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For Rand Char.

    =MID(G2,RANDBETWEEN(1,LEN(G2)),1)


    is 33

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For the license plates - should I be aiming to count how many pairs of license plates there are which share two letters and both have numbers < 15?

    The way I was approaching the problem gave a different number to your solution.

  5. #5
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For the license plate one, count how many have a pattern like these:

    MML132
    HFH265
    BBB722

    Notice they each have a letter that occurs at least twice, and all of them have digits which add up to less than 15.

  6. #6
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Licence PLATES ans is 22 formula length 115

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    yeah i though of the same for random character but i suspect clabulis wants us to isolate unique values so
    ouiwerjbvjkhvyusdnkvbsdjbjkbljkbsvvbgasdflwefpakjgheg
    becomes
    abdefghijklnoprsuvwy
    or its just been over thought
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by martindwilson View Post
    but i suspect clabulis wants us to isolate unique values so
    ouiwerjbvjkhvyusdnkvbsdjbjkbljkbsvvbgasdflwefpakjgheg
    becomes
    abdefghijklnoprsuvwy
    Exactly this.

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Random Character 103 so far.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by clabulis View Post
    My solution for License Plates is really bothering me. I feel like there's a much better way to solve it than the brute force method that I used. Hopefully someone can figure out a trick for this one!
    I really don't believe that a more concise approach is available for the License Plates challenge.

    The two criteria are sufficiently different to make a single approach unfeasible. What's more, since the array in question is already two-dimensional, any attempts at querying - en masse - individual characters within all strings within that array will run into the obvious problem of running out of "dimensions": for example, attempting to abbreviate e.g.:

    =SUM(MID(G2:P26,4,1)+MID(G2:P26,5,1)+MID(G2:P26,6,1))

    using a compound formula along the lines of:

    =SUM(0+MID(G2:P26,{4,5,6},1))

    would, in effect, require the "construction" of a three-dimensional grid to hold the relevant returns.

    Of course, we can first manipulate the range G2:P26 into a single-column or single-row array, so that the above construction is then viable, but since these challenges are all about minimizing formula length the cost here would simply be too high.

    Regards

  11. #11
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For the license plates the best I managed was 155:

    =SUM(IF((IFERROR(FIND(LEFT(G2:P26,1),G2:P26,2),0)+IFERROR(FIND(MID(G2:P26,2,1),G2:P26,3),0))*IF((MID(G2:P26,4,1)+MID(G2:P26,5,1)+RIGHT(G2:P26,1))<15,1),1))

  12. #12
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    First attempt for license plates puts me at 170. Hopefully I can find some fluff. Some of the shortcuts I like to use are rendered useless with the 2 dimensional array...
    Last edited by Hawkeye16; 07-28-2014 at 04:19 AM.
    Despite the high cost of living, it remains very popular.

    Don't forget to mark threads SOLVED when you get an answer and rep all the geniouses that helped you today!

  13. #13
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    For licence plate latest of mine is 131

  14. #14
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Slight improvement to the license plate one, got down to 140:

    =SUM(NOT(ISERR(FIND(LEFT(G2:P26,1),G2:P26,2))*ISERR(FIND(MID(G2:P26,2,1),G2:P26,3)))*((MID(G2:P26,4,1)+MID(G2:P26,5,1)+RIGHT(G2:P26,1))<15))

  15. #15
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    excelliot - What happened to your answer of 22 (typo I assumed) and length of 115 previously posted?

  16. #16
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Hawkeye16 View Post
    excelliot - What happened to your answer of 22 (typo I assumed) and length of 115 previously posted?
    yes, it was not correct.

    Correct ans is 12 with length of 131

  17. #17
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    I gotcha, I thought just the 22 was a typo but you still had 115.

  18. #18
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Random Character at 119, first attempt that gave me an accurate result, let's see if I can shorten now..

    Assuming any random string is going to be Lower Case letters only without spaces as the sample string is:

    Edit
    117!
    ------------------------
    {=CHAR(LARGE(--(NOT(ISERR(FIND(CHAR(ROW(97:122)),G2))))*ROW(97:122),RANDBETWEEN(1,COUNT(FIND(CHAR(ROW(97:122)),G2)))))}
    ------------------------
    Last edited by Speshul; 07-28-2014 at 03:08 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  19. #19
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    I'll post mine for Random Character since Speshul has done so, which uses similar logic though comes in at 103 characters:

    Array-entered:

    =CHAR(AGGREGATE(14,6,FIND(CHAR(ROW(A:A)),G2)^0*ROW(A:A),RANDBETWEEN(1,COUNT(FIND(CHAR(ROW(A:A)),G2)))))

    Regards

  20. #20
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    oi not fair,not everyone has 2011

  21. #21
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Ooooh XOR LX. That's where I could have shortened mine down a couple characters...

    I didn't need the "97:122 for the count on the randbetween since it's just a count"

    I'm just happy I was able to solve it by myself

  22. #22
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by martindwilson View Post
    oi not fair,not everyone has 2011
    Says the man who proposed a solution using 2013's IFNA() the other week!

  23. #23
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Speshul View Post
    I'm just happy I was able to solve it by myself
    Are you kidding? Yours was an excellent solution: I'm just a bit more practised now with these tricks to save characters!

    Cheers

  24. #24
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    no i didnt, i just pointed out it was there..so formulas could be theoretically be made shorter, but i think this should be restricted to any of pre 2007,2007, or 2007 and greater or solutions calculated for each

  25. #25
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    License Plate: 12 plates found matching the conditions, 173 chars (below in white)

    =SUMPRODUCT(--(RIGHT(G2:P26,1)+MID(G2:P26,4,1)+MID(G2:P26,5,1)<15)*--((LEFT(G2:P26,1)=MID(G2:P26,2,1))+(LEFT(G2:P26,1)=MID(G2:P26,3,1))+(MID(G2:P26,3,1)=MID(G2:P26,2,1))>0))
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  26. #26
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by martindwilson View Post
    no i didnt, i just pointed out it was there..so formulas could be theoretically be made shorter, but i think this should be restricted to any of pre 2007,2007, or 2007 and greater or solutions calculated for each
    Why? 2010 is four years old now: at what point are we "allowed" to say that this version is "chronologically acceptable"?

    I could equally argue that this should be for 2003 and earlier only - your choice of versions and how "old" they are is completely arbitrary, unless of course you have some statistics to support your claim, e.g.:

    % of forum users who have 2003 only: 10%
    % of forum users who have 2007 only: 80%
    % of forum users who have 2010 only: 10%

    Regards

  27. #27
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    i am never going to buy 2010/2013 not worth the expense
    and i wont be here for the next version anyway

  28. #28
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Stealing Speshul's formula, this is a slightly shorter version (110)

    [COLOR="#FFFFFF"]{=CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(97:122)),G2))*ROW(97:122),INT(RAND()*COUNT(FIND(CHAR(ROW(97:122)),G2))+1)))[COLOR]

    I can't test it but I guess Xor's formula could use the same construct for the second arguement of the large function to save a character as well.
    Last edited by ragulduy; 07-29-2014 at 11:32 AM.

  29. #29
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Can someone post the shorter License plates? I got the answer ya'll are posting (12) but did it in 173 chars I would love to see some shorter formulas!

    If someone already posted, please point me to it!

  30. #30
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by ragulduy View Post
    Stealing Speshul's formula, this is a slightly shorter version (110)

    [COLOR="#FFFFFF"]{=CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(97:122)),G2))*ROW(97:122),INT(RAND()*COUNT(FIND(CHAR(ROW(97:122)),G2))+1)))COLOR]

    I can't test it but I guess Xor's formula could use the same construct for the second arguement of the large function to save a character as well.
    Nice idea, ragulduy.

    Regards

  31. #31
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by GeneralDisarray View Post
    Can someone post the shorter License plates?
    Try this one with 125 (array formula below in white)

    =SUM((MID(G2:P26,4,1)+MID(G2:P26,5,1)+RIGHT(G2:P26)<15)*(1-(FIND(MID(G2:P26,2,1),G2:P26)=2)*(FIND(MID(G2:P26,3,1),G2:P26)=3)))
    Last edited by daddylonglegs; 07-29-2014 at 11:29 AM.
    Audere est facere

  32. #32
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Thank you, I was finally able to find some after scrolling all responses a third time.

    Pretty good ideas to add to my bag of tricks, thank you OP for another great game

    I went right for sumproduct() - that's my go-to formula for multi-conditional problems like this.

  33. #33
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Small variation to make it 117.....

    =SUM((MID(G2:P26,4,1)+MID(G2:P26,5,1)+RIGHT(G2:P26)<15)*(FIND(MID(G2:P26,2,1),G2:P26)*FIND(MID(G2:P26,3,1),G2:P26)<6))

  34. #34
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Am I missing something on the Random Characters, it seems much easier than all the other games posted.

    I get 33 chars -- are we supposed to do more than just return a single character?

    =MID(G2,RANDBETWEEN(0,LEN(G2)),1)

  35. #35
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by GeneralDisarray View Post
    Am I missing something on the Random Characters, it seems much easier than all the other games posted.

    I get 33 chars -- are we supposed to do more than just return a single character?

    =MID(G2,RANDBETWEEN(0,LEN(G2)),1)
    Have you ensured that every character present in the string has an equal probability of being returned? Remember that not all letters of the alphabet may necessarily be in that string.

    Regards

  36. #36
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by ragulduy View Post
    Stealing Speshul's formula, this is a slightly shorter version (110)

    [COLOR="#FFFFFF"]{=CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(97:122)),G2))*ROW(97:122),INT(RAND()*COUNT(FIND(CHAR(ROW(97:122)),G2))+1)))[COLOR]

    I can't test it but I guess Xor's formula could use the same construct for the second arguement of the large function to save a character as well.
    Stole it back, and shortened by three more characters! (107)

    =CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(97:122)),G2))*ROW(97:122),INT(RAND()*COUNT(FIND(CHAR(ROW(A:A)),G2))+1)))


    Quote Originally Posted by XOR LX View Post
    Are you kidding? Yours was an excellent solution: I'm just a bit more practised now with these tricks to save characters!
    Cheers
    :D

    Honestly, before about four weeks ago when I finally saw a visual to whats going on inside an array, I didn't have a clue how they worked, or when they were useful.

    These games have about doubled my understanding of formulas.

  37. #37
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    I have a thought for the final games;

    Participants should save each formula attempt or version, failed or not, and when solutions are posted here post your 'log' of versions to show exactly how your formula evolved and changed, it would also show the numerous methods which can be utilized to achieve the same result. I know personally I was playing around with >CHOOSE< before i decided to go with a >LARGE/RANDBETWEEN< combination.


    I think that would be pretty useful for those 'watching from the sidelines' on these (which is me, on most of them!)

  38. #38
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by XOR LX View Post
    Have you ensured that every character present in the string has an equal probability of being returned? Remember that not all letters of the alphabet may necessarily be in that string.

    Regards

    Ohhhhhhhhhhhhhhhhhhhhhhhh I see now. That's a bit different :D Thank you

  39. #39
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Speshul View Post
    These games have about doubled my understanding of formulas.
    Couldn't agree more, which is why I made a point before going on holiday to thank clabulis for beginning these challenges. I myself believe I have improved by a considerable degree having started to tackle these problems.

    Regards

  40. #40
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    That solution you guys found for random Char is completely new to me I'm going to have to make sure i didn't miss any of these games - I've only caught two of the workbooks i think. I'm decent with arrray formulas but these games have definitely been novel problems for the general.

    Thank you clabulis!

  41. #41
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    I was wondering the same thing. I suppose now I understand (hopefully), if the string were to be aaaaaaaaaab, the formula should have a 50% chance of returning a or b. Is that correct?

  42. #42
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Hawkeye16 View Post
    I was wondering the same thing. I suppose now I understand (hopefully), if the string were to be aaaaaaaaaab, the formula should have a 50% chance of returning a or b. Is that correct?
    I believe so, yes.

    Regards

  43. #43
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    @speshul or someone, can you explain why you aren't using something like

    =CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(A:A)),G2))*ROW(A:A),INT(RAND()*COUNT(FIND(CHAR(ROW(A:A)),G2))+1))

    (changed row references)


    instead? It seems to return the same and is shorter but I am sure there is a reason. It seems odd to use it in the second part but not the first part to me.

  44. #44
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Hawkeye16 View Post
    @speshul or someone, can you explain why you aren't using something like

    =CHAR(LARGE(ISNUMBER(FIND(CHAR(ROW(A:A)),G2))*ROW(A:A),INT(RAND()*COUNT(FIND(CHAR(ROW(A:A)),G2))+1))

    (changed row references)


    instead? It seems to return the same and is shorter but I am sure there is a reason. It seems odd to use it in the second part but not the first part to me.
    Perhaps he just forgot. Have you looked at all the previous posts in this thread? You'll see that that construction has been used if you do...

    Regards

  45. #45
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Oh. Interesting. So I had the shortest formula for this one afterall

    Well, learning experience! Here is why I overlooked this:

    I think the reason is how I build my formulas. I build step by step, then manually go back and combine them all when I'm done.

    So, in my early versions of the Random Character spreadsheet I started with using: (White font)

    Q5:Q30 {=ROW(97:122)}
    R5:R30 {=--(NOT(ISERR(FIND(CHAR(ROW(97:122)),G2))))}
    S5:S30 =Q5*R5

    This gave me, in S5:S30 a visual of the array list, so I could see {97,98,0,0,101,0,0,0,...etc} , for when "aaabbebb" is in G2. I do this so I can see how the formula is functioning in steps, to troubleshoot specific sections instead of one long formula

    If I use A:A, these formulas do not accurately return the CHAR number of the letter found. As I continued to develop and tweak the formula for shortness, I disregarded the idea that A:A could be used because it couldn't before. However, you are correct that the final product does return the right values with A:A.

    My last post of 107 chars (#36 on this thread), where I used both 97:122 AND A:A was because I still believed I needed to find/return using a 97:122, but the RANDBETWEEN(1,n) value I wanted to search for could havebeen any number, so the {1,2,3,4,5,...} that A:A would return would be perfectly acceptable for this section of the formula.

    I hope this helps explain the confusing mess that is my thought process!
    Last edited by Speshul; 07-30-2014 at 11:06 AM.

  46. #46
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by Speshul View Post
    Oh. Interesting. So I had the shortest formula for this one afterall
    What length are you declaring now, then? Does that beat by 103 from post #19? And remember that I still haven't incorporated ragulduy's recommendation of INT(RAND(... which should save another character...

    Or do you agree with Martin that post-2007 solutions should be disallowed?

    Also, why have you suddenly decided to reveal parts of your solution for all to see? I thought we were staying "white font" for the time being?

    Regards

  47. #47
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Ah you're right, I forgot that the modified 107 length version of mine originally modified by ragulduy, was modified to 101 posted by Hawkeye


    So...my original formula post of 117 would be shortened down to 108, not 101.

    Also, forgot the whitefont...applied now!
    Last edited by Speshul; 07-30-2014 at 11:11 AM.

  48. #48
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Quote Originally Posted by GeneralDisarray View Post
    That solution you guys found for random Char is completely new to me I'm going to have to make sure i didn't miss any of these games - I've only caught two of the workbooks i think. I'm decent with arrray formulas but these games have definitely been novel problems for the general.

    Thank you clabulis!

    You're very welcome! I'm glad everyone here has been enjoying them!

  49. #49
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    I wish I could have more time to check on these threads as much as I'd like, but this new job is killing my schedule.

    As for the Random Character problem, my solution is the same as all of you (my length is 111), but my syntax wasn't optimized as much as it should have been.

    I can't make any improvements over the license plates solutions that you guys have posted either haha.

  50. #50
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Shortest Formula Challenge!! (Game 8: Plates & Rand. Char.)

    Nice to see the process. I should do something more like that in the future. Currently I write the whole thing as I believe it should be and troubleshoot by highlighting certain sections and pressing F9 to see what it evaluates to in order to troubleshoot.

+ 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. Shortest Formula Challenge!! (Games 6 & 7)
    By clabulis in forum The Water Cooler
    Replies: 29
    Last Post: 07-30-2014, 10:11 AM
  2. Replies: 11
    Last Post: 07-24-2014, 08:43 AM
  3. Shortest Formula Challenge!! (Game 4: Occ. % & Cap. Pairs)
    By clabulis in forum The Water Cooler
    Replies: 23
    Last Post: 07-24-2014, 08:21 AM
  4. Shortest Formula Challenge!! (Games 1-3)
    By clabulis in forum The Water Cooler
    Replies: 98
    Last Post: 07-11-2014, 06:12 PM
  5. Shortest Formula Challenge!! (Games 1-3)
    By clabulis in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2014, 02:20 PM

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