There are 3 views in Excel: Normal View, Page Break Preview, and Page Layout View. You can use the ruler only in Page Layout View. Please see here why the rule gray out, or follow the steps below to set the ruler unit to centimeter.
Step 1: Click the "File" Tab from the ribbon;
Step 2: Click "Options" from the left navigation menu;
Step 3: Click "Advanced" from the left navigation menu;
Step 4: Select "Centimeters" from "Ruler Unit" under the "Display" section;
Step 5: Click "OK" at the bottom to apply the changes.