def col(label: str) -> int:
    """Return the correct index given an Excel column letter."""
    if not label.isalpha():
        raise ValueError(f"'{label}' is not a valid column label.")
    return (
        sum(
            (ord(char) - ord("A") + 1) * (26 ** position)
            for position, char in enumerate(reversed(label.upper()))
        )
        - 1
    )