If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Lookup data

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-10, 06:33
lucyg_2000 lucyg_2000 is offline
Registered User
 
Join Date: Nov 2003
Location: england
Posts: 95
Lookup data

Hello Guys,

I wonder if you can help,

In Excel - I have two spreadsheets. I need to copy the values from Sheet 2 column date to sheet 1 column date.


Example:

Sheet 1 Sheet 2
col 1 | Date Col 1 | Date
a 02/03/2010 b 01/01/2010
b 01/01/2010 a 02/03/2010
c 03/03/2010 c 03/03/2010

Can any lookup functions achieve this? As you can see the data in Sheet 2 isnt sorted the same as sheet 1.

Thanks

Lucy
Reply With Quote
  #2 (permalink)  
Old 03-12-10, 07:52
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 477
Hi Lucy,

So long as there is only one row of each date then, yes, you can use VLOOKUP() (or a similar combination of functions) to pull the data over.

How many rows and columns of data are there?

Would you like me to attach an example?
__________________
Colin

My Excel articles

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 03-12-10, 11:38
lucyg_2000 lucyg_2000 is offline
Registered User
 
Join Date: Nov 2003
Location: england
Posts: 95
Hello Colin,

Each row contains a date or contain blanks. I thought of using VLOOKUP but it mentioned something about only using data that has been sorted in ascending order. The data I am trying to match is sorted differently on sheet 2 compared to sheet 1.

Sheet 1

col1 col2
A37/890 | BRISTOL ROAD [Insert date data from sheet 2 (inc blanks) when col 1 sheet 1 matches col 1 sheet 2]
A37/930 | BRISTOL ROAD [Insert date data from sheet 2 (inc blanks) when col 1 sheet 1 matches col 1 sheet 2]


Sheet 2

Col 1 Col 2
A37/890 | BRISTOL ROAD 11/05/2004
A37/930 | BRISTOL ROAD
Reply With Quote
  #4 (permalink)  
Old 03-12-10, 17:28
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 477
Hi Lucy,

When using VLOOKUP(), the optimal approach is to use [range_lookup] = 1 (or TRUE) but this requires the data to be in ascending order. If you pass in 0 (or FALSE) then it will find an exact match irrelevant of the order of the data - the trade off is that the lookup is a touch slower. A lot of people prefer to use INDEX() and MATCH() for this, but the formula is more complicated, so I think that you're best off using VLOOKUP() here.

I've attached a simple example to show that it can be used when the data order is mixed up. The main restrictions with VLOOKUP() are that you can only lookup data to the right of the lookup column and that the lookup column index (eg. 2 for 2nd column) is a magic number: it won't adjust if you insert a column in the lookup table.
Attached Files
File Type: zip Quick VLOOKUP example.zip (5.9 KB, 11 views)
__________________
Colin

My Excel articles

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On