Created
January 8, 2017 19:49
-
-
Save huemorgan/754a639d9a59cb13a5e006cefd3c34e9 to your computer and use it in GitHub Desktop.
calculate excel cohort diagonals fields in ruby by dapulse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = ['c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] | |
y = [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34] | |
length = y.length | |
strings = [] | |
for index in 0..length | |
substring = "=" | |
for i in 0..(index) | |
substring = substring + "+" if substring != "=" | |
substring << "#{x[i]}#{y[index-i]}" | |
end | |
strings << substring | |
end | |
strings.each{|s| puts s } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it's always horrible to make diagonal field fetching in excel for cohorts, manual and annoying, this scripts creates the formulas, just copy & paste each field - still annoying but much less.