Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

If Null Then Match from Another Column in a Different Row

taran42
8 - Asteroid

I am looking to fill in the country field when it is null based on the matching state from another row. So if "Nashville" has a Country that is null, then look in the State field for another "TN" and fill in the Country that's associated with it, which would be "United States."

 

Current

IDCityStateCountry
1VancouverBC 
2VancouverBCCanada
3NashvilleTNUnited States
4NashvilleTN 
5ChicagoILUnited States

 

Expected Result

IDCityStateCountry
1VancouverBCCanada
2VancouverBCCanada
3NashvilleTNUnited States
4NashvilleTNUnited States
5ChicagoILUnited States

 

I have tried various formulas and the Find and Replace tool, but no luck yet.

3 REPLIES 3
ctrl_kudorje
8 - Asteroid

For This, i would recommend:

  1. Creating a new table where only City and State is selected.
  2. Remove Duplicates by City and State.
  3. Remove all rows where State is null/blank
  4. Then utilizing Find and Replace join your main data with the new table. 
  5. Then remove any columns that are not needed.
PhilipMannering
16 - Nebula
16 - Nebula

Very similar to how @ctrl_kudorje describes. Think I would prefer the Join over the Find Replace Tool here though.

PhilipMannering_0-1656701309095.png

 

binuacs
21 - Polaris

@taran42 One way of dong this with the multirow tool

 

binuacs_0-1656708242075.png

 

Labels
Top Solution Authors