Merge two excel files (with the condition)
- by chennai
I have a form in access in which i have two text boxes which accepts two excel files with a button click.
now when i click generate button an output excel file has to be generated or created based on the following conditions
In one excel file i have these data :
id code country count
t100 gb123 india 3123
t100 gh125 UK 1258
t123 ytr15 USA 1111
t123 gb123 Germany 100
t145 gh575 india 99
t458 yt777 USA 90
In another excel file i have these data
country location
India delhi
UK london
USA wallstreet
Germany frankfurt
The rows can be more than what i mentioned here ... now i want to merge them
according to the country. In book1 excel file for example wherever you find country india the location
field delhi has to be inserted right beside the country field and it has to be done for each and every country which i mentioned in book2 excel file
and the output file has to be sorted according to the count at last.
For example the output file should like this
id code country count Location
t100 gb123 india 3123 delhi
t100 gh125 UK 1258 london
t123 ytr15 USA 1111 wallstreet
t123 gb123 Germany 100 frankfrt
t145 gh575 india 99 delhi
t458 yt777 USA 90 wallstreet