def cell_to_rowcol(cell)
    cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/

    col_rel = $1 == "" ? 1 : 0
    row_rel = $3 == "" ? 1 : 0
    row     = $4.to_i

    col = chars_to_col($2.split(//))

    # Convert 1-index to zero-index
    row -= 1
    col -= 1

    [row, col, row_rel, col_rel]
  end
def cell_to_rowcol(cell)
    cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/

    col_rel = $1 == "" ? 1 : 0
    row_rel = $3 == "" ? 1 : 0
    row     = $4.to_i

    col = chars_to_col($2.split(//))

    # Convert 1-index to zero-index
    row -= 1
    col -= 1

    [row, col, row_rel, col_rel]
  end
Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
 indexed row and column number. Also returns two boolean values to indicate
 whether the row or column are relative references.
 TODO use function in Utility.pm