ststern45
Well-known Member
- Joined
- Sep 17, 2005
- Messages
- 974
- Office Version
- 365
- 2010
- Platform
- Windows
Hi everyone,
Need help with a function/vba
I have the following 5 numbers from 1 to 30 in ascending order:
Notice below adding all the results would equal 5 (1-1-1-1-1 =5, 2-2-1-0-0 = 5, 5-0-0-0-0 = 5, 4-1-0-0-0 = 5, etc)
7 Possible Results
1-1-1-1-1
2-1-1-1-0
2-2-1-0-0
3-1-1-0-0
3-2-0-0-0
4-1-0-0-0
5-0-0-0-0
07-12-20-22-29
If the gap between each number not equal to 1 or no consecutive digits such as 01-02 etc. I would like the result to be 1-1-1-1-1
10-13-14-17-25
2-1-1-1-0
02-03-12-29-30
Above there are 2 consecutive numbers 02-03 and 29-30
Result = 2-2-1-0-0
01-02-03-07-14
Result = 3-1-1-0-0
08-09-25-26-27
Result = 3-2-0-0-0
3-04-05-06-08
4 consecutive numbers
Result = 4-1-0-0-0
01-02-03-04-05
5 consecutive numbers
Result = 5-0-0-0-0
Thank you!!
Need help with a function/vba
I have the following 5 numbers from 1 to 30 in ascending order:
Notice below adding all the results would equal 5 (1-1-1-1-1 =5, 2-2-1-0-0 = 5, 5-0-0-0-0 = 5, 4-1-0-0-0 = 5, etc)
7 Possible Results
1-1-1-1-1
2-1-1-1-0
2-2-1-0-0
3-1-1-0-0
3-2-0-0-0
4-1-0-0-0
5-0-0-0-0
07-12-20-22-29
If the gap between each number not equal to 1 or no consecutive digits such as 01-02 etc. I would like the result to be 1-1-1-1-1
10-13-14-17-25
2-1-1-1-0
02-03-12-29-30
Above there are 2 consecutive numbers 02-03 and 29-30
Result = 2-2-1-0-0
01-02-03-07-14
Result = 3-1-1-0-0
08-09-25-26-27
Result = 3-2-0-0-0
3-04-05-06-08
4 consecutive numbers
Result = 4-1-0-0-0
01-02-03-04-05
5 consecutive numbers
Result = 5-0-0-0-0
Thank you!!