Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default copy if data matches

I have two excel workbooks that are generated on a daily basis. What
I would like to do is find out if information on todays workbook is a
match with information on the previous days workbook and if it is I
want to copy the matching information from a 3rd column and place it
in todays workbook.

The workbooks have the same format
(old workbook) (new
workbook)
Info to copy ticket number copy here ticket
number
---------------- -------------------
------------- -------------------
19809 5550157 5499795
19798 5624887 5786878
5499695 5550157
5499691 5079389
5499693
19773 5499698

As you can see the length of the ticket number column is different
every day it may have 1 item in it or 1000. As you can see ticket
number 5550157 matches in both workbooks, so I need to copy 19809 into
the new workbook and put them in the row that matches 5550157. Of
course these numbers are not constant, but they are unique to each
days work. So if 5550157 shows up on the previous day and today's
workbook it is the only time it shows up, there are not mulitple
instances of that check number in the report. I would like to use a
macro to run this match with no interaction from the end user. I have
tried to use offset to make dynamic ranges and using match but can't
figure out how to actually copy the data from a different column if
there is actually a match.

I hope that this is clear.

-Chris
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default copy if data matches

Check out these functions:

VLOOKUP - http://www.contextures.com/xlFunctions02.html

INDEX MATCH - http://www.contextures.com/xlFunctions03.html




" wrote:

I have two excel workbooks that are generated on a daily basis. What
I would like to do is find out if information on todays workbook is a
match with information on the previous days workbook and if it is I
want to copy the matching information from a 3rd column and place it
in todays workbook.

The workbooks have the same format
(old workbook) (new
workbook)
Info to copy ticket number copy here ticket
number
---------------- -------------------
------------- -------------------
19809 5550157 5499795
19798 5624887 5786878
5499695 5550157
5499691 5079389
5499693
19773 5499698

As you can see the length of the ticket number column is different
every day it may have 1 item in it or 1000. As you can see ticket
number 5550157 matches in both workbooks, so I need to copy 19809 into
the new workbook and put them in the row that matches 5550157. Of
course these numbers are not constant, but they are unique to each
days work. So if 5550157 shows up on the previous day and today's
workbook it is the only time it shows up, there are not mulitple
instances of that check number in the report. I would like to use a
macro to run this match with no interaction from the end user. I have
tried to use offset to make dynamic ranges and using match but can't
figure out how to actually copy the data from a different column if
there is actually a match.

I hope that this is clear.

-Chris

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 220
Default copy if data matches

Here's an example:

Sub test()
For Each cell In Range("A1:A50")
Set found = Range("B1:B50").Find( _
What:=cell.Value, _
LookIn:=xlValues)
If Not found Is Nothing Then
cell.Copy found.Offset(, 1)
End If
Next cell
End Sub

--
Dan


On Apr 17, 12:43*pm, wrote:
I have two excel workbooks that are generated on a daily basis. *What
I would like to do is find out if information on todays workbook is a
match with information on the previous days workbook and if it is I
want to copy the matching information from a 3rd column and place it
in todays workbook.

The workbooks have the same format
* * * * * (old workbook) * * * * * * * * * * * * * * * * * * *(new
workbook)
Info to copy * ticket number * * * * * * * * * * * copy here * ticket
number
---------------- * -------------------
------------- * *-------------------
19809 * 5550157 * * * * * * * * * * * * 5499795
19798 * 5624887 * * * * * * * * * * * * 5786878
* * * * 5499695 * * * * * * * * * * * * 5550157
* * * * 5499691 * * * * * * * * * * * * 5079389
* * * * 5499693
19773 * 5499698

As you can see the length of the ticket number column is different
every day it may have 1 item in it or 1000. *As you can see ticket
number 5550157 matches in both workbooks, so I need to copy 19809 into
the new workbook and put them in the row that matches 5550157. *Of
course these numbers are not constant, but they are unique to each
days work. *So if 5550157 shows up on the previous day and today's
workbook it is the only time it shows up, there are not mulitple
instances of that check number in the report. *I would like to use a
macro to run this match with no interaction from the end user. *I have
tried to use offset to make dynamic ranges and using match but can't
figure out how to actually copy the data from a different column if
there is actually a match.

I hope that this is clear.

-Chris

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default copy if data matches

Thanks to you both, I was able to use both these examples to make a
macro that will find and copy the data I need

Thanks again,
Christopher

On Apr 17, 12:36*pm, "Dan R." wrote:
Here's an example:

Sub test()
* For Each cell In Range("A1:A50")
* * Set found = Range("B1:B50").Find( _
* * * * * * * * * What:=cell.Value, _
* * * * * * * * * LookIn:=xlValues)
* * If Not found Is Nothing Then
* * * cell.Copy found.Offset(, 1)
* * End If
* Next cell
End Sub

--
Dan

On Apr 17, 12:43*pm, wrote:



I have two excel workbooks that are generated on a daily basis. *What
I would like to do is find out if information on todays workbook is a
match with information on the previous days workbook and if it is I
want to copy the matching information from a 3rd column and place it
in todays workbook.


The workbooks have the same format
* * * * * (old workbook) * * * * * * * * * * * * * * * * * * *(new
workbook)
Info to copy * ticket number * * * * * * * * * * * copy here * ticket
number
---------------- * -------------------
------------- * *-------------------
19809 * 5550157 * * * * * * * * * * * * 5499795
19798 * 5624887 * * * * * * * * * * * * 5786878
* * * * 5499695 * * * * * * * * * * * * 5550157
* * * * 5499691 * * * * * * * * * * * * 5079389
* * * * 5499693
19773 * 5499698


As you can see the length of the ticket number column is different
every day it may have 1 item in it or 1000. *As you can see ticket
number 5550157 matches in both workbooks, so I need to copy 19809 into
the new workbook and put them in the row that matches 5550157. *Of
course these numbers are not constant, but they are unique to each
days work. *So if 5550157 shows up on the previous day and today's
workbook it is the only time it shows up, there are not mulitple
instances of that check number in the report. *I would like to use a
macro to run this match with no interaction from the end user. *I have
tried to use offset to make dynamic ranges and using match but can't
figure out how to actually copy the data from a different column if
there is actually a match.


I hope that this is clear.


-Chris- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you count data that matches more than one condition? ryesworld Excel Worksheet Functions 9 March 23rd 09 02:41 AM
Find Data from one sheet that matches Brian Shafer Excel Discussion (Misc queries) 1 October 19th 07 06:58 PM
Data Matches Stacey Excel Discussion (Misc queries) 1 February 20th 07 02:24 PM
highlighing data which matches an SQL query Dr Sanjay Excel Discussion (Misc queries) 0 May 2nd 06 11:27 AM
Vlookup 2 data matches? Nav Excel Discussion (Misc queries) 5 November 27th 05 04:18 PM


All times are GMT +1. The time now is 02:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"