Excel.CustomDataValidation interface
Represents the custom data validation criteria.
Remarks
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/22-data-validation/data-validation-types.yaml
function applyCustom(sheet: Excel.Worksheet) {
// Custom formula: Value in B8 must not duplicate any value already in B2:B7.
const customRule: Excel.CustomDataValidation = {
formula: "=COUNTIF($B$2:$B$7,B8)=0"
};
const rule: Excel.DataValidationRule = { custom: customRule };
sheet.getRange("B8").dataValidation.rule = rule;
}
Properties
| formula | A custom data validation formula. This creates special input rules, such as preventing duplicates, or limiting the total in a range of cells. |
Property Details
formula
A custom data validation formula. This creates special input rules, such as preventing duplicates, or limiting the total in a range of cells.
formula: string;
Property Value
string