Hi !
I have a column of 'City', now I want to compare the value of each cell of 'City' against the column 'City_Check'; the cell where the value matches, pick the value of 'City_ID' column & replace the city name with that ID in the 'City column'.
* The Image clarifies what I want(Plz see the attachments)... I have my original data file attached as well.
Regards.

Recommended Answers

All 5 Replies

Hi fashxfreak, daniweb is a great site but you need a help forum that deals specifically with Excel & MS Office applications. I suggest www.thecodecage.com You'll find all the help you'll need for this issue.

As it is, I'll see what I can do for you here.

What is the trigger to make this table? Do you want this to populate after each City entry?

@Stuugie thx for suggestion man !
Actually I just want a table having 'site_ID' & 'City_ID'. i.e. check the city from column 'B', compare it with all the city names of column 'D', when the match is found, copy the city_id against that city from column 'C' & replace the city name with that city_id in column 'B'.

I have worked this out two different ways for you. The first way is by using the WorkSheet_Change event. If you want/need to learn about the worksheet change event then take a look at Google. For the first way, everytime a city is input it will change to the city_ID. This way can be done on the worksheet "Assign ID @ Entry"

The second way is by running the procedure on worksheet "Assign All IDs" which takes the cities as a batch and then converts the names to the IDs.

Let me know if this is close

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.