Parsing Key Value pairs from inconsistent and incomplete data

excel_lente

New Member
Joined
May 20, 2019
Messages
1
Hey all,

I have a CSV file with the following data in rows:

[TABLE="width: 867"]
<tbody>[TR]
[TD]{'gender': 'male', 'age': '35', 'hometown': 'Chicago', 'car': 'Civic', 'occupation': 'actor', 'salary': '80000'}[/TD]
[/TR]
[TR]
[TD]{'gender': 'male', 'age': '32', 'hometown': 'New York', 'occupation': 'banker', 'salary': '130000'}[/TD]
[/TR]
[TR]
[TD]{'gender': 'female', 'age': '33', 'hometown': 'Seattle', 'occupation': 'developer'}[/TD]
[/TR]
[TR]
[TD]{'age': '27', 'hometown': 'Detroit', 'car': 'Mustang', 'salary': '75000'}

As you can see, there are recurring attributes (i.e. Gender, Age, Hometown, Car, Occupation, Salary), but this data is complete for every record, making it difficult / impossible to simply separate via Column-To-Test techniques.

Is there a way to use Excel to parse this data into columns and rows?

I'd like to use the attributes as column headers, so that when a "value" is missing, it would simply be a blank cell:

[TABLE="width: 498"]
<tbody>[TR]
[TD]gender[/TD]
[TD]age[/TD]
[TD]hometown[/TD]
[TD]car[/TD]
[TD]occupation[/TD]
[TD]salary[/TD]
[/TR]
[TR]
[TD]Male[/TD]
[TD]35[/TD]
[TD]Chicago[/TD]
[TD]Civic[/TD]
[TD]Actor[/TD]
[TD]80000[/TD]
[/TR]
[TR]
[TD]Male[/TD]
[TD]32[/TD]
[TD]New York[/TD]
[TD][/TD]
[TD]Banker[/TD]
[TD]130000[/TD]
[/TR]
[TR]
[TD]Female[/TD]
[TD]33[/TD]
[TD]Seattle[/TD]
[TD][/TD]
[TD]Developer[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thanks in advance![/TD]
[/TR]
</tbody>[/TABLE]

excel_lente

Also posted
https://www.excelforum.com/excel-ge...rs-from-inconsistent-and-incomplete-data.html
 
Last edited by a moderator:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,884
Messages
6,181,553
Members
453,053
Latest member
Kiranm13

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
Back
Top