473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Merge two excel files into another one

Hi everybody,

I have two excel files please find attached documents
and also i am attaching the output file how it should look like.

i have a form in Access which accepts two files
book1 and book2
with a generate button. when i click generate button it should accept these two excel files and generate another excel file called output.

Thank you for the help

Regards,
chennai
Attached Files
File Type: xlsx Book1 - Copy.xlsx (13.5 KB, 371 views)
File Type: xlsx Book2 - Copy.xlsx (8.7 KB, 383 views)
File Type: xlsx Output.xlsx (13.6 KB, 455 views)
Jun 26 '13 #1
9 3357
zmbd
5,501 Expert Mod 4TB
Most of us either can not or will not open un-requested attacments. This should not be taken personally. It is often due to the fact that we are at work PCs and our IT staff prohibits doing so, or, in fact, is part of the general "Best Safe Computing Practices."
Instead, please try to clearly state what your goal is, what you have tried (we like to see the work), what the results were along with the EXACT title, number, and text of any error messages you've received.
Jun 26 '13 #2
Actually i am not a developer ...
i am looking for a program where i can get this task done. Because it is really annoying me to do manually.
so please help me.


@zmbd
Jun 27 '13 #3
The main goal is:
in book1.xls i have a header row with the following columns:
Role
code
country
count
And in the book2.xls file have a header row with the following columns
country
location
Now i need to match country field in book1.xls and get the location field from book2.xls and place exactly right beside country field in book1.xls and this is what in the output file which i attached.

if any more information you need please let me know
@chennai141
Jun 27 '13 #4
zmbd
5,501 Expert Mod 4TB
You should be able to do this without using Access.
Which version of Excel are you using?
Does the data in Book2 change?

Just so that I understand what you are currently doing:
you have been opening book1, inserting a column next to the "country" and entering "location" for the header. You are then by hand opening book2 and then, by hand, looking up the information from book2 as a cross reference and by hand entering that value, yes?

For this first part, the built in macro recorder can build your base code. As such would be normally available to you, the basic code will be:
Expand|Select|Wrap|Line Numbers
  1. Sub InsertColumnForLocation()
  2. '
  3.     Range("A1").Select
  4.     Columns("D:D").Select
  5.     Selection.Insert Shift:=xlToRight
  6.     Range("D1").FormulaR1C1 = "Location"
  7.     Range("A1").Select
  8. End Sub
Note that I am working on the concept that your headers are in row1. So the first thing I do in this code is send you to Home on the worksheet - not strictly needed; however, bad habit.
Then We slect the entire D column (same as clicking on the column-button) and then insert the column (there are other ways to do this; however, I've sometimes had deep cells not shift properly useing them whereas this method doesn't seem to fail) and the header text.
This is very plain, no formating etc...

The next step will be how to handle the data.
That may depend somewhat on the version of excel you are using.
What I would do is bring in your book2 data, sort it on the country field, assign it a range name, then use VBA to enter a VLOOKUP() formula into your location column.

-
Sorry, no, still not opening the attachments, still at a work PC.
Also as we progress thru this project, please keep in mind that Bytes is neither a code writing nor homework service.
Jun 27 '13 #5
Hi thank you for the effort and helping me a lot..
but it is not the right one what i want...
if you could send me your id then i can send files to you..

Thank you for the help
Jun 29 '13 #6
zmbd
5,501 Expert Mod 4TB
chennai141
hi,
thank you for the effort and helping me a lot..
>>But it is not the right one what i want...
If you could send me your id then i can send files to you..

Thank you for the help
You need to explain that with a tad more descriptive detail - blame it on the children :). Is it that you are being required to use Access, the first and or second part of the solution doesn't work, or some other reason?

As for sending files via private messaging. The site rules generally prohibit the "Staff" from handling things via PM or offsite - exceptions can be made; however, I'd involve one of the site admins before doing so... The main reason is that if the solution is found, then the thread, and therefor the site and our memebers, do not benefit from the effort and the solution.


> How to ask "good" questions.
> FAQ = Asking Questions
> Posting Guidleings.
Jun 29 '13 #7
Hi

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
Jun 30 '13 #8
zmbd
5,501 Expert Mod 4TB
Is this a school project or an employment interview question?!
It certainly sounds like "How many quarters does it take on edge to equal the height of The Empower State Building?"
If you truly are stuck with the requirement that you must first import the files into MS Access, then you need to look at the transferspread sheet method.
I have a few threads onsite that have gone into some detail about this. It will take me a little bit to find them; however, I will post back the thread links in a little bit (I've got to find them :) ), or you can search the forum for them.
Transferworksheet Method
One of about a dozen threads where I've covered this:
http://bytes.com/topic/access/answer...acts-email-vba
Jul 1 '13 #9
hahhaha its not a school project neither interview question .
its a part of self learning...After getting this done i want to generate the output file with the graph....

If you find any other links please let me know ...
thank you
Jul 1 '13 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: JT | last post by:
can someone point me in the right direction here?? i have two excel files containing identical columns: ExcelDocA: DealerName New Used joedealer 2 4 bobdealer 3 ...
2
by: Jen | last post by:
Trying to take one table in access and split it into multiple excel files(using an excel template); and then email based on email addresses in Table2; Of course, I would like to do all of this...
4
by: rn5a | last post by:
Which namespace do I have to import to work with MS-Excel files? I have a Excel file named 'Procs.xls' in which there is some data in 'Sheet1'. What I would like to do is by clicking a Button in...
18
by: gonzlobo | last post by:
No, I don't want to destroy them (funny how the word 'decimate' has changed definition over the years) :). We have a data acquisition program that saves its output to Excel's ..xls format....
28
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
1
by: adamrace | last post by:
Hi, I've got two excel files, one has a list of products and their current prices and they all have a product ID, I have another file with a list of price's that need updating. I was wondering...
9
by: Peter | last post by:
Does anyone has .NET library to merger RTF files? Thank You Peter
0
by: selvialagar | last post by:
I have more than one Excel files in a directory. now i have to make all the excel files in a single excel file. Each file in that directory should be taken as a worksheet in the new file.. Is it...
3
by: stephen | last post by:
Hi, I have 5 excel files and they have multiple sheets. I have to read (say sheet 3) of each of the 5 excel files and consolidate them into one. what's the best way to achieve this. if someone...
1
by: vengateshbabu | last post by:
How to merge many Excel files in to one using Python I am using windows Platform amd Python Version 2.7
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.