Returning the Names Associated with a DCID

The =DCGETNAME(dcids) formula returns the names associated with given DCIDs to a cell or a column range of cells.

Note: Be sure to follow the instructions for Installing and Enabling the Sheets Add-On before using this formula.

Formula

=DCGETNAME(dcids)

Required Arguments

dcids - A list of node DCIDs to query.

Returns

The names associated with given node DCIDs to a cell or a range of cells.

Note: It’s best to minimize the number of function calls to =DCGETNAME(dcids) by using a single call to get the names for a column of nodes. This is because a spreadsheet will make one call to a Google server per custom function call. If your sheet contains thousands of separate calls to =DCGETNAME(dcids) you can expect it to be slow and return with errors.

Examples

This section contains examples of returning the names associated with given DCIDs.

Example 1: Retrieve the Name of a Place by its DCID

To retrieve the name of a place by its DCID, perform the following steps:

  1. Place your cursor in the cell where you want to add a DCID. In this case, cell A1.
  2. Move to the cell where you want to retrieve the place name.
  3. Enter the formula =DCGETNAME(A1) to retrieve the name. California populates the cell.

Retrieving the name of a country by its DCIC

Example 2: Retrieve the Names of a Collection of Power Plants

To retrieve the names of a collection of power plants, perform the following steps:

  1. Enter into column A the DCIDs that are shown in the following image.
  2. In cell B2, enter the formula =DCGETNAME(A2:A4). The names of the countries for each DCID populates in column B.

Retrieving the names of a collection of power plants

Example 3: Retrieve the names of a list of statistical variables

Statistical Variables are also nodes in the Data Commons Graph with a DCID. To retrieve the names of a list of statistical variables, perform the following steps:

  1. Enter into column A the DCIDs that are shown in the following image.
  2. In cell B2, enter the formula =DCGETNAME(A2:A4). The names of the countries for each DCID populates in column B.

Retrieving the names of a collection of power plants

Error Responses

If a DCID does not exist, the =DCGETNAME(dcids) formula does not return a value. For example, because the “geoId/123123123” DCID does not exist, no value is returned to cell B1 in the following sheet:

No value returned for a DCID that does not exist

If you provide an empty cell for a DCID, the =DCGETNAME(dcids) formula returns a value of #ERROR!, as shown show in the following image:

#ERROR! value returned for an empty cell for a DCID