Computer >> Computer tutorials >  >> Software >> Office

How to Create a Hierarchy of the State City and Zip Code in Excel

To express an address, usually we need state, city name, and code. In a state, there are several cities. And under one city there are several zip code areas. In this article, we will create a hierarchy with state, city, and zip code in Excel. Like, first we will choose a state. Then, choose the cities of that state. Lastly, we will get zip code areas under each city.

What Is a Hierarchy Table?

The hierarchy table is a table that is used to represent the relationship between different events. It tells how the events are related to each other. Which is the parent component and which is the child component.

How to Create a Hierarchy of the State City and Zip Code in Excel

The following shows the state, city, and zip code hierarchy.

Steps to Create a Hierarchy of the State City and Zip Code in Excel

We will show all the steps in detail of how to create a hierarchy with state, city, and zip code in Excel. First, we made a date set of 5 states. We will collect further data based on this dataset.

How to Create a Hierarchy of the State City and Zip Code in Excel

⦿ Step 1: Prepare Data

In this step, we will prepare data for the hierarchy of states, cities, and zip codes.

  • First, we collect the name of 5 cities in each state.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • After that, we collect several zip codes under the cities of Georgia state.

How to Create a Hierarchy of the State City and Zip Code in Excel

Next, we do this for other states.

  • Data of Florida state.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Data of Alabama state.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Data of California state.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Data of Hawaii state.

How to Create a Hierarchy of the State City and Zip Code in Excel

Our dataset is ready now.

Read More: How to Create Hierarchy in Excel Pivot Table (with Easy Steps)

⦿ Step 2: Create a List of States Using Data Validation

To create a hierarchy we will apply the data validation feature of Excel.

  • First, we create a table for creating a hierarchy list.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • After that, select Cell B5.
  • Choose Data Tools from the Data tab.
  • Select the Data Validation option.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • The Data Validation dialog box appears.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Choose the List option from the Allow box drop-down list.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • After that, put a formula on the Source box.
=Hierarchy!$B$5:$B$9

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Finally, click the OK button.

How to Create a Hierarchy of the State City and Zip Code in Excel

We can see a drop-down symbol beside the selected cell.

  • After that, copy Cell B5 by pressing Ctrl + C.
  • Then, choose Range B6:B9.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Then, go to the Paste drop-down.
  • Choose Paste Special option.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Paste Special window appears.
  • Check the Validation option from the Paste section.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Finally, click on the OK button.

How to Create a Hierarchy of the State City and Zip Code in Excel

We can see the drop-down symbol is showing for the other cells.

  • Insert options from the drop-down list of each cell.

How to Create a Hierarchy of the State City and Zip Code in Excel

Read More: How to Add Row Hierarchy in Excel (2 Easy Methods)

⦿ Step 3: Create a City List with Data Validation

In this step, we will apply data validation in the City column.

  • Choose Cell C5 to apply Data Validation.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Go to the Data Validation window as shown before.
  • Now put the following formula on the Source
=OFFSET(Hierarchy!B$11,1,MATCH($B5,Hierarchy!$B$11:$F$11,0)-1,5,1)
  • Then, press the OK button.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Look at the dataset.

How to Create a Hierarchy of the State City and Zip Code in Excel

We can see the drop-down list and the options at the drop-down list. Expand the drop-down list to Range C6:C9.

  • Choose Cell C5.
  • Copy that cell by pressing Ctrl+C.
  • Then, choose Range C6:C9. After that, press Ctrl+ Alt+ V for paste special.
  • Then, check the Validation option from the Paste Special window.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Finally, choose the OK button.

How to Create a Hierarchy of the State City and Zip Code in Excel

We can see options from the data validation drop-down list.

Read More: How to Create Multi Level Hierarchy in Excel (2 Easy Ways)

⦿ Step 4: Create Zip Code Drop-Down List

Now, we will apply data validation to the Zip column. This data validation is based on the values of Range C5:C9.

  • Select Cell D5 first.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Enter the Data Validation window as shown before.
  • Inset a formula on the Source box.
=OFFSET(Hierarchy!B$19,1,MATCH($C$5,Hierarchy!$B$19:$F$19,0)-1,5,1)
  • Click on the OK button.

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Now, look at the dataset.
  • Click on the down arrow of the drop-down list.

How to Create a Hierarchy of the State City and Zip Code in Excel

See the Zip code on the list. We apply this for the rest of the cells of Range C5:C9.

  • The formula of Data Validation for Cell D6.
=OFFSET(Hierarchy!B$27,1,MATCH($C$6,Hierarchy!$B$27:$F$27,0)-1,5,1)

How to Create a Hierarchy of the State City and Zip Code in Excel

  • The formula of Data Validation for Cell D7.
=OFFSET(Hierarchy!B$35,1,MATCH($C$7,Hierarchy!$B$35:$F$35,0)-1,5,1)

How to Create a Hierarchy of the State City and Zip Code in Excel

  • The formula of Data Validation for Cell D8.
=OFFSET(Hierarchy!B$43,1,MATCH($C$8,Hierarchy!$B$43:$F$43,0)-1,5,1) 

How to Create a Hierarchy of the State City and Zip Code in Excel

  • The formula of Data Validation for Cell D9.
=OFFSET(Hierarchy!B$51,1,MATCH($C$9,Hierarchy!$B$51:$F$51,0)-1,5,1) 

How to Create a Hierarchy of the State City and Zip Code in Excel

  • Look at the dataset again.

How to Create a Hierarchy of the State City and Zip Code in Excel

We can select Zip codes from the drop-down list.

Conclusion

In this article, we described how to create a hierarchy of the state, city, and zip code in Excel. I hope this will satisfy your needs. Please have a look at our website Exceldemy.com and give your suggestions in the comment box.

Related Articles

  • How to Make Hierarchy Chart in Excel (3 Easy Ways)
  • Create Date Hierarchy in Excel Pivot Table (with Easy Steps)
  • How to Use SmartArt Hierarchy in Excel (With Easy Steps)