I have a spreadsheet similar to the following:
<pre>
<b>Name Title ID</b>
Person 1 Title 1 1
Person 2 Title 2 11
Person 3 Title 3 111
Person 4 Title 4 1111
Person 5 Title 5 12
Person 6 Title 6 121
Person 7 Title 7 1211
Person 8 Title 8 1212
Person 9 Title 9 122
Person 10 Title 10 13
Person 11 Title 11 131
Person 12 Title 12 1311
Person 13 Title 13 1312
Person 14 Title 14 13121
Person 15 Title 15 1313
Person 16 Title 16 132
Person 17 Title 17 1321
Person 18 Title 18 14
Person 19 Title 19 15
Person 20 Title 20 151
Person 21 Title 21 1512
</pre>
I want to iterate through each cell in the "ID" column.
If the column contains a value, then copy the entire row to a new sheet.
Here's the tricky part:
<pre>
- The first number will always start with 1.
- I want the script to search "ID" for 1 + another single digit (10,11,12,13...).
For all cells that match the criteria copy that row to a new sheet.
- When that is done, now search for 11 + another single digit (111,112,113,114...).
- When that is done, now search for 12 + another digit (121,122,123,124...)
</pre>
This should keep going:
<pre>
Search "ID" for: Finds all:
19 191, 192, 193, 194...
124 1241, 1242, 1243, 1244...
1111 11111, 11112, 11113, 11114, 11115...
1127 11271, 11272, 11273, 11274...
12345 123451, 123452, 123453, 123454, 123455...
</pre>
The preceding digits before the '+ another single digit' dictate what sheet it should go in.
<pre>
- If search for 1 + another single digit - these should all go on a single sheet.
- If searching for 11 + another single digit - these should go on a single sheet.
- If search for 1234 + another single digit - these should go on a single sheet.
- So on and so forth.
</pre>
Any help is greatly appreciated and thank you in advance!
<pre>
<b>Name Title ID</b>
Person 1 Title 1 1
Person 2 Title 2 11
Person 3 Title 3 111
Person 4 Title 4 1111
Person 5 Title 5 12
Person 6 Title 6 121
Person 7 Title 7 1211
Person 8 Title 8 1212
Person 9 Title 9 122
Person 10 Title 10 13
Person 11 Title 11 131
Person 12 Title 12 1311
Person 13 Title 13 1312
Person 14 Title 14 13121
Person 15 Title 15 1313
Person 16 Title 16 132
Person 17 Title 17 1321
Person 18 Title 18 14
Person 19 Title 19 15
Person 20 Title 20 151
Person 21 Title 21 1512
</pre>
I want to iterate through each cell in the "ID" column.
If the column contains a value, then copy the entire row to a new sheet.
Here's the tricky part:
<pre>
- The first number will always start with 1.
- I want the script to search "ID" for 1 + another single digit (10,11,12,13...).
For all cells that match the criteria copy that row to a new sheet.
- When that is done, now search for 11 + another single digit (111,112,113,114...).
- When that is done, now search for 12 + another digit (121,122,123,124...)
</pre>
This should keep going:
<pre>
Search "ID" for: Finds all:
19 191, 192, 193, 194...
124 1241, 1242, 1243, 1244...
1111 11111, 11112, 11113, 11114, 11115...
1127 11271, 11272, 11273, 11274...
12345 123451, 123452, 123453, 123454, 123455...
</pre>
The preceding digits before the '+ another single digit' dictate what sheet it should go in.
<pre>
- If search for 1 + another single digit - these should all go on a single sheet.
- If searching for 11 + another single digit - these should go on a single sheet.
- If search for 1234 + another single digit - these should go on a single sheet.
- So on and so forth.
</pre>
Any help is greatly appreciated and thank you in advance!
Last edited: