API Reference

Cmdlet

Add-OfficeExcelValidationCustomFormula

Aliases: ExcelValidationCustomFormula
Namespace PSWriteOffice
Aliases
ExcelValidationCustomFormula
Inputs
OfficeIMO.Excel.ExcelDocument

Adds a custom-formula data validation rule to a worksheet range.

Remarks

Adds a custom-formula data validation rule to a worksheet range.

Examples

Authored help example

Example 1: Restrict cells based on a formula.

PS>


ExcelSheet 'Data' { Add-OfficeExcelValidationCustomFormula -Range 'F2:F20' -Formula 'LEN(F2)>0' }
        

Ensures the validation formula evaluates to true.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Add-OfficeExcelValidationCustomFormula [-AllowBlank <Boolean>] [-ErrorMessage <String>] [-ErrorTitle <String>] -Formula <String> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Range <String>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Context

Parameters

AllowBlank Boolean optionalposition: namedpipeline: False
Allow blank values.
ErrorMessage String optionalposition: namedpipeline: False
Error message shown to the user.
ErrorTitle String optionalposition: namedpipeline: False
Error title shown to the user.
Formula String requiredposition: 1pipeline: False
Validation formula.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the target range.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range string after applying validation.
Range String optionalposition: 0pipeline: False
Target range in A1 notation.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.
Add-OfficeExcelValidationCustomFormula [-AllowBlank <Boolean>] -Document <ExcelDocument> [-ErrorMessage <String>] [-ErrorTitle <String>] -Formula <String> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

AllowBlank Boolean optionalposition: namedpipeline: False
Allow blank values.
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
ErrorMessage String optionalposition: namedpipeline: False
Error message shown to the user.
ErrorTitle String optionalposition: namedpipeline: False
Error title shown to the user.
Formula String requiredposition: 1pipeline: False
Validation formula.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the target range.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range string after applying validation.
Range String optionalposition: 0pipeline: False
Target range in A1 notation.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.