Formula to validate for incorrect Hierarchy rollup

tina16marie

New Member
Joined
May 17, 2016
Messages
2
Hello, I need help!

I need to create a formula that will help me validate data within a hierarchy rollup. As an example, I created a spreadsheet of cities with the State, Country, and Continent they map to. I'm looking to create a formula that returns a count if the state maps into more than one country.

Example of valid hierarchy - This example is valid because each State maps into 1 country.
Validate for incorrect Hierarchy rollup
ContinentCountryState/ProvCity1:1 mapping from City to State/Prov1:1 mapping from State/Prov to Country1:1 mapping from Country to Continent
North AmericaUnited StatesCaliforniaLos Angeles
1​
1​
1​
North AmericaUnited StatesCaliforniaSan Diego
1​
1​
1​
North AmericaUnited StatesCaliforniaSan Francisco
1​
1​
1​
North AmericaUnited StatesNew YorkNew York
1​
1​
1​
North AmericaUnited StatesNew YorkHempstead
1​
1​
1​
North AmericaUnited StatesNew YorkAlbany
1​
1​
1​
North AmericaCanadaOntarioToronto
1​
1​
1​
North AmericaCanadaOntarioOttawa
1​
1​
1​
North AmericaCanadaQuebecMontreal
1​
1​
1​
North AmericaCaribbeanJamaicaMontego Bay
1​
1​
1​

Example of invalid hierarchy - This data is invalid because California maps into 2 countries (United States and Caribbeans) and New York maps into 2 countries (United States and Canada). I need a formula that will result a 2 in the The 1:1 mapping from State/Prov to Country column.
Validate for incorrect Hierarchy rollup
ContinentCountryState/ProvCity1:1 mapping from City to State/Prov1:1 mapping from State/Prov to Country1:1 mapping from Country to Continent
North AmericaUnited StatesCaliforniaLos Angeles
1​
2
1​
North AmericaUnited StatesCaliforniaSan Diego
1​
2
1​
North AmericaUnited StatesCaliforniaSan Francisco
1​
2
1​
North AmericaUnited StatesNew YorkNew York
1​
2
1​
North AmericaUnited StatesNew YorkHempstead
1​
2
1​
North AmericaUnited StatesNew YorkAlbany
1​
2
1​
North AmericaCanadaNew YorkToronto
1​
2
1​
North AmericaCanadaOntarioOttawa
1​
1​
1​
North AmericaCanadaQuebecMontreal
1​
1​
1​
North AmericaCaribbeanCaliforniaMontego Bay
1​
2
1​
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
64,110
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=SUMPRODUCT(IF($C$2:$C$20=C2,1/(COUNTIFS($C$2:$C$20,C2,$B$2:$B$20,$B$2:$B$20))))
 

Forum statistics

Threads
1,144,629
Messages
5,725,387
Members
422,622
Latest member
Paranthem

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top