Search code examples
libreoffice-calc

How to restrict character in a particular cell


I am using a excel. It has name and age column, which allows both number and character while editing. I don't want to allow number in name column and don't allow text in age column.

How can I achieve that?


Solution

  • In LibreOffice, it is straightforward to allow only numbers in the age column.

    1. Data -> Validity
    2. Allow: Whole Numbers
    3. Data: valid range
    4. Minimum: 0
    5. Maximum: 199

    However it does not look like this same approach can be used to limit numbers.

    If you are up for a challenge, it should be possible to write an event handler macro that runs whenever a cell value gets modified. It could verify that the name only has letters.