New-SLDefinedName


Synopsis

Create a Defined Name for a cell reference, range, constant, formula, or table.

Syntax

Description

A name is a meaningful shorthand that makes it easier to understand the purpose of a cell reference,
constant, formula, or table, each of which may be difficult to comprehend at first glance.
The following information shows common examples of names and how they can improve clarity and understanding.

EXAMPLE TYPE EXAMPLE WITH NO NAME EXAMPLE WITH A NAME
Reference =SUM(C20:C30) =SUM(FirstQuarterSales)
Constant =PRODUCT(A5,8.3) =PRODUCT(Price,WASalesTax)
Formula =SUM(VLOOKUP(A1,B1:F20,5,FALSE), -G5) =SUM(Inventory_Level,-Order_Amt)
Table C4:G36 =TopSales06

Parameters

-WorkBookInstance

Instance of an excel document that can be used for editing.

Required? True
Position? 0
Default value  
Accept pipeline input? true (ByValue)
Accept wildcard characters? False

-WorksheetName

Name of the Worksheet that contains the Range referenced by the defined name.

Required? True
Position? 1
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-DefinedName

A userfriendly Name for a cell reference, range, constant, formula, or table.

Required? True
Position? 2
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-Range

cellrange which would be the datasource for a defined name.
To define a cellreference instead of a range use the range format like so: B3:B3

Required? True
Position? named
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-Force

If the defined name to be created already exists in the workbook use the force switch to overwrite the existing value.
By default the cmdlet will not overwrite an existing Defined Name.

Required? False
Position? named
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-WhatIf

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-Confirm

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-Comment

Comment that provides a short description of the defined name.

Required? True
Position? named
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-Scope

The name of the worksheet that the defined name is effective in.

Required? False
Position? named
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

String,SpreadsheetLight.SLDocument

Outputs

SpreadsheetLight.SLDocument

Notes

Examples

Example 1

Create a New defined name &;39;DFName1&;39;.

Example 2

Create a New defined name &;39;DFName1&;39;.Additionally specify a comment to describe the defined name.

Example 3

Create a New defined name &;39;DFName1&;39;.Additionally specify a comment and scope.
Because we specified &;39;sheet2&;39; as the value for the scope parameter, the defined name &;39;DFName3&;39; can only be used on worksheet named &;39;sheet2&;39;.

Related links

http://office.microsoft.com/en-in/excel-help/define-and-use-names-in-formulas-HA010147120.aspx