VBA to return only unique values from a range of comma separated words on multiple rows.

Ananthak275

Board Regular
Joined
Aug 22, 2020
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
  2. MacOS
Hi everyone,

I have the following rows of texts. My data starts on Row 2 (since there is a header). how do i get the unique values? and them pasted below the last row of that column. For example, CityName (Column A) starts in A2 and ends in A7, so i want the unique values to be pasted start on A8. While StateName starts in B2 and ends in B5, so i would want the unique states starting in b6?


1CityNameStateName
2Dallas. Houston, PhiladelphiaCalifornia, Texas
3
Chicago
Pennsylvania, California, Texas
4
Dallas. Houston, Philadelphia
Arizona, New York
5Houston, Philadelphia, AustinNew York
6Austin, New York City, Los Angeles
7San Jose
8
 
its duplicating cells that have no commas, a single word in the cell. In my table example, its duplicating "Chicago" as well.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Because you have cells with just a single value, how is the macro meant to know if it should be copied or not?
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

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