Return the names associated with DCIDs
The =DCGETNAME
formula returns the names associated with given DCIDs to a cell or range of cells.
Formula
=DCGETNAME(dcids)
Required arguments
dcids
- A node or range of cells representing multiple nodes, identified by their DCIDs.
Returns
The names associated with given node DCIDs to a cell or a range of cells.
Examples
This section contains examples of using DCGETNAME
to return the names associated with given DCIDs.
Note: Be sure to follow the instructions for for enabling the Sheets add-on before trying these examples.
Example 1: Retrieve the name of a place by its DCID
To retrieve the name of a place by its DCID:
- Place your cursor in the cell where you want to add a DCID; in this case, cell A1, and enter
geoId/06
. - Move to the cell where you want to retrieve the place name.
- Enter the formula
=DCGETNAME(A1)
to retrieve the name.California
populates the cell.
Example 2: Retrieve the names of a list of power plants
To retrieve the names of a list of power plants:
- Enter into column A the DCIDs that are shown in the following image.
- In cell B2, enter the formula
=DCGETNAME(A2:A4)
. The names of the power plants for each DCID populate column B.
Example 3: Retrieve the names of a list of statistical variables
Statistical variables are also nodes in the Data Commons knowledge with a DCID. To retrieve the names of a list of statistical variables:
- Enter into column A the DCIDs that are shown in the following image.
- In cell B2, enter the formula
=DCGETNAME(A2:A4)
. The names of the variables for each DCID populate column B.
Error responses
If a DCID does not exist, the =DCGETNAME
formula does not return a value. For example, because the DCID geoId/123123123
does not exist, no value is returned to cell B1 in the following sheet:
If you provide an empty cell for a DCID, the =DCGETNAME
formula returns a value of #ERROR!
, as shown show in the following image: