Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Last active December 23, 2015 06:29
Show Gist options
  • Save davidgrenier/6594719 to your computer and use it in GitHub Desktop.
Save davidgrenier/6594719 to your computer and use it in GitHub Desktop.
Convert Excel column to id
let columnNum =
let charValues =
['A'..'Z']
|> Seq.mapi (fun i c -> c, i + 1)
|> map
fun (code: string) ->
(Seq.toList code, (0,-1))
||> List.foldBack(fun v (depth, total) -> depth + 1, total + (pown 26 depth * charValues.[v]))
|> snd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment