def col_to_num(col):
    """
    Converts an excel-like column name (e.g. AA) into a number (e.g. 27)
    """
    num = 0
    for c in col:
        num = num * 26 + (ord(c.upper()) - ord('A')) + 1
    return int(num)