?
Solved

Use VLookup or is there a macro that would be better?

Posted on 2011-03-15
10
Medium Priority
?
357 Views
Last Modified: 2012-05-11
The object of the exercise is to get the Trans Total from trans.xls into the Period Total column of master.xls by cross-referencing the Badge Number.  

Trans is always a subset of Master, so the number of rows in trans.xls will never exceed the number of rows in master.xls.  

Any badge number found in trans.xls should exist in master.xls.  Whatever value is in Period Total will be overwritten to the Trans Total if badge numbers match, or be re-set to zero.  

The result should then be saved as summary_{date}.xls.

What can be tricky about this whole process is the following:

Every a week, the Accountant runs a report that summarizes all the transactions by badge and totals the transactions for the week.  

The Accountant then exports the report to a CSV and sends it to a Junior Admin Person.  

The Junior Admin Person currently manually cross-references the employee name and number and inserts it into a spreadsheet (Trans File) and sends it back to the Accountant who then sends it to corporate.  

The Accountant *could* do it, but wants the Junior Admin Person to do it instead.
 master.xls
trans.xls
0
Comment
Question by:Alex Campbell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 20

Expert Comment

by:Ardhendu Sarangi
ID: 35142585
i think it would be easier to code a macro rather than using vlookup.
0
 
LVL 1

Author Comment

by:Alex Campbell
ID: 35142640
Can you write the macro?
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35146006
I would like a few clarifications before I attempt this.

- Will the trans sheet contain the badge numbers before running the macro

- Will this list in trans fixed or varying

- Could it be that the trans list is created based on non-zero values in master list

- At the moment the master list does not contain any value in the period total. There should be values present there to be posted to the trans.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Alex Campbell
ID: 35147815


- Will the trans sheet contain the badge numbers before running the macro
yes

- Will this list in trans fixed or varying
Will vary

- Could it be that the trans list is created based on non-zero values in master list
No

- At the moment the master list does not contain any value in the period total. There should be values present there to be posted to the trans.  

***Thinks it goes the other way: from Trans to Master, but will double-check with customer.***

"The object of the exercise is to get the Trans Total from trans.xls into the Period Total column of master.xls by cross-referencing the Badge Number.  

Any badge number found in trans.xls should exist in master.xls.  Whatever value is in Period Total will be overwritten to the Trans Total if badge numbers match, or be re-set to zero.

The result should then be saved as summary_{date}.xls. "



-------------------------------------------------------------------------------------------------------------------------
The object of the exercise is to get the Trans Total from trans.xls into the Period Total column of master.xls by cross-referencing the Badge Number.  

Trans is always a subset of Master, so the number of rows in trans.xls will never exceed the number of rows in master.xls.  

Any badge number found in trans.xls should exist in master.xls.  Whatever value is in Period Total will be overwritten to the Trans Total if badge numbers match, or be re-set to zero.  

The result should then be saved as summary_{date}.xls.

What can be tricky about this whole process is the following:

Every a week, the Accountant runs a report that summarizes all the transactions by badge and totals the transactions for the week.  

The Accountant then exports the report to a CSV and sends it to a Junior Admin Person.  

The Junior Admin Person currently manually cross-references the employee name and number and inserts it into a spreadsheet (Trans File) and sends it back to the Accountant who then sends it to corporate.  

The Accountant *could* do it, but wants the Junior Admin Person to do it instead.
0
 
LVL 1

Author Comment

by:Alex Campbell
ID: 35147825
Information below --------- was put there while I was editing. Meant to delete before sending.
0
 
LVL 1

Author Comment

by:Alex Campbell
ID: 35147863
Checked with customer. The answers I gave above are correct.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35147866
This is an exerpt from the question

Any badge number found in trans.xls should exist in master.xls.  Whatever value is in Period Total will be overwritten to the Trans Total if badge numbers match, or be re-set to zero.  

and this one from your response to my queries

***Thinks it goes the other way: from Trans to Master

You need to clarify this. If the latter is the case then my queries are no longer relevant.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 35147873
So the statement in the question is wrong?
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 35148185
enter this formula in D2 and then copy it down

=IF(ISNA(VLOOKUP(C2,[trans.xls]nptest!$A:$B,2,0)),0,VLOOKUP(C2,[trans.xls]nptest!$A:$B,2,0))
 
0
 
LVL 1

Author Closing Comment

by:Alex Campbell
ID: 35149408
Customer very pleased, but had one suggestion that instead of choosing all rows, just use a1 to B500. Covers any possible situation, but is much faster than whole column.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question