Retrieve places contained within another place
The =DCPLACESIN
formula returns lists of child places from a list of parent Place
DCIDs. It only returns children with a place type that matches the place_type
parameter, such as State
, Country
, and so on.
Formula
=DCPLACESIN(dcids, place_type)
Required arguments
dcids
: A single place node or range of cells representing place nodes, identified by their DCIDs.place_type
: The type of the contained child place nodes to filter by. For example,City
andCounty
are contained withinState
. For a full list of available types, see the place types page.
Returns
A list of child place DCIDs of the specified place DCIDs, of the specified place type.
Examples
This section contains examples of using the =DCPLACESIN
formula to return places contained in another place.
Note: Be sure to follow the instructions for for enabling the Sheets add-on before trying these examples.
Example 1: Retrieve a list of counties in Delaware
To retrieve a list of counties in Delaware:
- Place your cursor in the cell where you want to add the DCID for Delaware; in this case, cell A2.
- Enter the Delaware DCID of
geoId/10
. - (Optional) In cell B2, enter
DCGETNAME(A2)
to retrieve Delaware’s name from the DCID in cell A2. - In cell C2, enter the formula
=DCPLACESIN(A2, "County")
. The DCIDs for the three Delaware counties populate column C. - In cell D2, enter the formula
DCGETNAME(C2:C4)
to retrieve the names of the counties.
Example 2: Retrieve congressional districts in Alaska and Hawaii
To retrieve the congressional districts in Alaska and Hawaii:
- In cell A2, enter
geoId/02
for the DCID of Alaska and in cell A3, entergeoId/15
for the DCID of Hawaii. - (Optional) In cell B1, enter
=DCGETNAME(A2:A3)
to retrieve the names of Alaska and Hawaii into column B. - In cell C2, enter
=DCPLACESIN(A2:A3, "CongressionalDistrict")
to retrieve the DCIDs of the congressional districts. - In cell D2, enter
=DCGETNAMES(C2:C4)
to retrieve the names of the congressional districts.
Error responses
If a DCID does not exist, the =DCPLACESIN
formula returns a value of #REF!
. For example, because the geoId/123123123
DCID does not exist, an error of #REF!
is returned to cell B1 in the following sheet:
If you provide an empty cell for a DCID, the =DCPLACESIN
formula returns a value of #ERROR!
, as shown show in the following image:
Finally, if you provide an invalid property to the =DCPLACESIN
formula, an error of #REF!
is also returned, as follows:
Page last updated: December 17, 2024 • Send feedback about this page