Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on nested loops
Hi!
I would like to get any helpful suggestion how to approach the following problem. If I have a single string made of the sequence of capital letters with no spaces, that may be input by user, and would ordinarily be n characters long, where n=5 to 100 or even more, different each time. How to create an Excel spreadsheet or an array, containing all possible combinations of deletions, where deletion spaces would gradually increase from 1 to n-1, such that the gradually shortet string would be created, as schematically outlined below: ABCDEGTWESRADCRFRIEOPTY ABCDEGTWESRADCRFRIEOPT ABCDEGTWESRADCRFRIEOP Y '1 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRIEO TY ABCDEGTWESRADCRFRIE PTY ABCDEGTWESRADCRFRI PTY ................................... .................................. ABCDEGTWESRADCRFRIEO Y ABCDEGTWESRADCRFRIE P Y '2 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRI OP Y ' FIRST AT POSITION 2, 2ND STARTS AT POS.3 etc ABCDEGTWESRADCRFR EOP Y .................................................. ............... .................................................. ........... ABCDEGTWESRADCRFRIEOP Y ABCDEGTWESRADCRFRIE Y ' 3 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRI O Y .................................................. ........ .................................................. ....... A Y ' n-2 DELETIONS, (N-2)TH DELETION AT POSITION 2 FROM LEFT B Y ' n-2 DELETIONS, (N-2)TH DELETION AT POSITION 1 FROM LEFT At first I tought of nested loops, but since the lenght of the string would be different in each case and so would a number of iterations how to do it? It would probably be n-1 iterations, different each time. Any alternative to nested loops? JasL *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on nested loops
From your description I have no idea what you are trying to do, but you can
handle variable string lengths by using Len, such as For i = 1 To Len(myString) etc. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Jan Lukszo" wrote in message ... Hi! I would like to get any helpful suggestion how to approach the following problem. If I have a single string made of the sequence of capital letters with no spaces, that may be input by user, and would ordinarily be n characters long, where n=5 to 100 or even more, different each time. How to create an Excel spreadsheet or an array, containing all possible combinations of deletions, where deletion spaces would gradually increase from 1 to n-1, such that the gradually shortet string would be created, as schematically outlined below: ABCDEGTWESRADCRFRIEOPTY ABCDEGTWESRADCRFRIEOPT ABCDEGTWESRADCRFRIEOP Y '1 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRIEO TY ABCDEGTWESRADCRFRIE PTY ABCDEGTWESRADCRFRI PTY .................................. ................................. ABCDEGTWESRADCRFRIEO Y ABCDEGTWESRADCRFRIE P Y '2 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRI OP Y ' FIRST AT POSITION 2, 2ND STARTS AT POS.3 etc ABCDEGTWESRADCRFR EOP Y .................................................. .............. .................................................. .......... ABCDEGTWESRADCRFRIEOP Y ABCDEGTWESRADCRFRIE Y ' 3 DELETIONS, STARTING FROM RIGHT ABCDEGTWESRADCRFRI O Y .................................................. ....... .................................................. ...... A Y ' n-2 DELETIONS, (N-2)TH DELETION AT POSITION 2 FROM LEFT B Y ' n-2 DELETIONS, (N-2)TH DELETION AT POSITION 1 FROM LEFT At first I tought of nested loops, but since the lenght of the string would be different in each case and so would a number of iterations how to do it? It would probably be n-1 iterations, different each time. Any alternative to nested loops? JasL *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with nested for loops | Excel Discussion (Misc queries) | |||
Help with nested for loops | Excel Worksheet Functions | |||
Max limit of 7 nested loops | Excel Worksheet Functions | |||
Nested loops?? | Excel Programming | |||
RANGE & NESTED LOOPS | Excel Programming |