Hi everyone!
I have a sheet with thousand of records and I have to run a specific function on one of the columns. The latter contains a large number of duplicates. I set up a new function with VB, but I cannot run it on all the data due to the required computational effort. Therefore I thought to create a new column without replicates, and to run the function on this new column.
However, I do not have a clue on how I can assign the new values (obtained running the function on the new column) to the entries of the original table. I thought to do that with a series of nested IF, but it would be simply impossible due to the high amount of data.
Here a simple table to exemplify my problem:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Key[/TD]
[TD]City (with replicates)[/TD]
[TD]Preferred food of the citizens[/TD]
[TD][/TD]
[TD]City (without replicates)[/TD]
[TD]Preferred food of the citizens[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Chicago[/TD]
[TD][/TD]
[TD][/TD]
[TD]Chicago[/TD]
[TD]Hamburger[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD]New York[/TD]
[TD]Pizza[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD]Roma[/TD]
[TD]Pasta[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD]Londra[/TD]
[TD]Fish&Chips[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]New York[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Chicago[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
As you can see in the table, I have a list of rows (identified by a keys), each of which has an attribute "city". Suppose that with my VB function I am able to calculate the preferred food of the inhabitants given the name of the city. The function is quite expensive and I cannot run it over all my entries: therefore I create a new column without replicates, and I run the function on this new set. Then I have to re-assign the outcome of the functions to my initial set of rows...
Any suggestion on how I should do?
Thank you in advance for your time!
I have a sheet with thousand of records and I have to run a specific function on one of the columns. The latter contains a large number of duplicates. I set up a new function with VB, but I cannot run it on all the data due to the required computational effort. Therefore I thought to create a new column without replicates, and to run the function on this new column.
However, I do not have a clue on how I can assign the new values (obtained running the function on the new column) to the entries of the original table. I thought to do that with a series of nested IF, but it would be simply impossible due to the high amount of data.
Here a simple table to exemplify my problem:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Key[/TD]
[TD]City (with replicates)[/TD]
[TD]Preferred food of the citizens[/TD]
[TD][/TD]
[TD]City (without replicates)[/TD]
[TD]Preferred food of the citizens[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Chicago[/TD]
[TD][/TD]
[TD][/TD]
[TD]Chicago[/TD]
[TD]Hamburger[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD]New York[/TD]
[TD]Pizza[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD]Roma[/TD]
[TD]Pasta[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD]Londra[/TD]
[TD]Fish&Chips[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Roma[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]New York[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Londra[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Chicago[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
As you can see in the table, I have a list of rows (identified by a keys), each of which has an attribute "city". Suppose that with my VB function I am able to calculate the preferred food of the inhabitants given the name of the city. The function is quite expensive and I cannot run it over all my entries: therefore I create a new column without replicates, and I run the function on this new set. Then I have to re-assign the outcome of the functions to my initial set of rows...
Any suggestion on how I should do?
Thank you in advance for your time!