Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2012, 08:35 PM
Boatwrenchv8's Avatar
Boatwrenchv8 Boatwrenchv8 is offline Looking up data and populate a new sheet Windows 7 64bit Looking up data and populate a new sheet Office 2010 32bit
Novice
Looking up data and populate a new sheet
 
Join Date: Apr 2012
Posts: 23
Boatwrenchv8 is on a distinguished road
Default Looking up data and populate a new sheet

Hello,
I am tring to figure out the functions to use in order to look up data in 2 (or more) sheets and populate a new sheet with the required data. In the example I attached, the First sheet (Company Accidents) contains data on what employee was injured, whether it was avoidable or not and if they passed a drug test. We may filter this sheet's data in one or more columns based on the report requested by the client. Also, this sheet's column order may change the next time it is supplied to us and is beyond our control. The order the columns are in this time may not be the same the next time but the overall sheet will have the same column headings. BUT let's assume the employee number column will always be in column A (and if it is not, I can move it to column A)

The Second sheet (Employee Data) contains the employee's date of birth, number of accidents the employee has had and so on. This data's column order may change too but will have the same column heading names. Again, let's assume the employee number column will always be in column A (and if it is not, I can move it to column A). This data will not be filtered but will be very lengthy, probably over containing over 150 employees.

The Third sheet (2012 Accident Data) is the sheet I want to generate. I would want each employee number appearing in the first sheet to appear by formula on the 3rd sheet and based on the employee number, fill in the rest of the values requested for the 3rd sheet. Since the column order may change I did not think that Vlookup would work. What would I use to generate the 3rd sheet? Is this possible to do using formulas or would it be better to use VBA? I did something similar to this before and it did work but it took a lot of time to tediously set up the tables in excel to make the Vlookup work properly.



Any help is very much appreciated,

Rich
Reply With Quote
  #2  
Old 04-06-2012, 07:08 PM
caholmes caholmes is offline Looking up data and populate a new sheet Windows Vista Looking up data and populate a new sheet Office 2007
Advanced Beginner
 
Join Date: Dec 2008
Location: Sydney, Australia
Posts: 54
caholmes is on a distinguished road
Default

Hi Rich,

you can nest a match function inside a vlookup to work out the column number for you.

So a simple vlookup would look like this:
=VLOOKUP(A2,'Company Accidents'!A1:H6,2,0)

with a nested match function:
=VLOOKUP(A2,'Company Accidents'!A1:H6,MATCH(B$1,'Company Accidents'!$A$1:$H$1,0),0)

and finally to fix any errors if not found, add an iferror function:
=IFERROR(VLOOKUP(A2,'Company Accidents'!A1:H6,MATCH(B$1,'Company Accidents'!$A$1:$H$1,0),0),"")

Please see attached solution
Attached Files
File Type: xlsx Vlookup with Nested Match.xlsx (10.5 KB, 24 views)
Reply With Quote
  #3  
Old 04-06-2012, 07:39 PM
Boatwrenchv8's Avatar
Boatwrenchv8 Boatwrenchv8 is offline Looking up data and populate a new sheet Windows 7 64bit Looking up data and populate a new sheet Office 2010 32bit
Novice
Looking up data and populate a new sheet
 
Join Date: Apr 2012
Posts: 23
Boatwrenchv8 is on a distinguished road
Default

Craig,
Thank you very much for replying. I didn't think of doing that! I will do some experimenting with the nested match function and will post back here ASAP.
Rich
Reply With Quote
  #4  
Old 04-06-2012, 07:43 PM
caholmes caholmes is offline Looking up data and populate a new sheet Windows Vista Looking up data and populate a new sheet Office 2007
Advanced Beginner
 
Join Date: Dec 2008
Location: Sydney, Australia
Posts: 54
caholmes is on a distinguished road
Default

No Problems Rich. Please mark as Solved if you don't have any further questions
Reply With Quote
  #5  
Old 04-13-2012, 05:56 PM
Boatwrenchv8's Avatar
Boatwrenchv8 Boatwrenchv8 is offline Looking up data and populate a new sheet Windows 7 64bit Looking up data and populate a new sheet Office 2010 32bit
Novice
Looking up data and populate a new sheet
 
Join Date: Apr 2012
Posts: 23
Boatwrenchv8 is on a distinguished road
Default

Been up to my eyes in another project and will consider this question answered. Thank you very much Craig for your help.

Rich
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate dropdown list with data from Access table spw4000 Office 0 02-24-2012 05:22 AM
Looking up data and populate a new sheet Link data from embedded excel sheet rwbarrett Word 1 05-27-2011 02:05 AM
Looking up data and populate a new sheet How do I merge data from one sheet in a workbook out into multiple sheets nolesca Excel 4 06-07-2010 08:13 AM
Looking up data and populate a new sheet Compare data in different columns in an Excel sheet kgfendi Excel 5 05-16-2009 05:42 PM
Setting up Analysis Sheet when data does not exist, yet. burnoutdetective Excel 0 10-13-2008 05:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft