Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Michael A
 
Posts: n/a
Default finding duplicate then copying macro..

Ok, first of all, this community has been so great, and I wanted to thank you
all. I have a new thing i need to do, and i was wanting to see if anyone can
help me.

I need a macro that will look at the information on the current sheet, and
compare it to the information on the previous sheet and copy a value.
here is what i need

If any value on the current sheet in column A B and C matches anything on
the previous sheet in column A B and C (The line needs to have all 3 match),
then the macro would copy the value in the G column to the new page.


For example
Sheet 13
A B C G

Cat Dog Cat Not a Moose


then when the macro finds the same ABC on the new sheet, it fills in G for
me.

any help would be great.. Thanks!


  #2   Report Post  
Max
 
Posts: n/a
Default

Perhaps a formulas approach might also work ?

Assume your source sheet is Sheet1,
cols A to C, with answers in col G,
data from row2 down

Cat Dog Cat Not a Moose
Cat Cat Cat Definitely a Cat
Cat Cat Dog Not a Moose2
etc

Answers: "Not a Moose", "Definitely a Cat", etc are in col G

Assume that Sheet2 will be the inputs sheet,
where the corresponding inputs below will be made
in cols A to C, row2 down:

Cat Dog Cat
Cat Cat Cat
Cat Cat Dog
etc

In Sheet3
------------
Assume col A is where we want the answers to be

Put in the formula bar for A2:

=IF(COUNTBLANK(Sheet2!A2:C2)<0,"",IF(ISNA(MATCH(S heet2!A2&Sheet2!B2&Sheet2!
C2,Sheet1!A2:A100&Sheet1!B2:B100&Sheet1!C2:C100,0) ),"",INDEX(Sheet1!G2:G100,
MATCH(Sheet2!A2&Sheet2!B2&Sheet2!C2,Sheet1!A2:A100 &Sheet1!B2:B100&Sheet1!C2:
C100,0))))

Array-enter the formula, i.e. press CTRL+SHIFT+ENTER
instead of just pressing ENTER

Copy A2 down to A100
(can copy down ahead of expected inputs in Sheet2)

Col A will return the corresponding results from col G in Sheet1 for the
inputs made in Sheet2's cols A to C matched against the source data in
Sheet1's cols A to C

If the inputs in cols A to C in Sheet2 are incomplete, or the inputs made do
not match with what's in Sheet1, blanks: "" will be returned

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Michael A" wrote in message
...
Ok, first of all, this community has been so great, and I wanted to thank

you
all. I have a new thing i need to do, and i was wanting to see if anyone

can
help me.

I need a macro that will look at the information on the current sheet, and
compare it to the information on the previous sheet and copy a value.
here is what i need

If any value on the current sheet in column A B and C matches anything on
the previous sheet in column A B and C (The line needs to have all 3

match),
then the macro would copy the value in the G column to the new page.


For example
Sheet 13
A B C G

Cat Dog Cat Not a Moose


then when the macro finds the same ABC on the new sheet, it fills in G for
me.

any help would be great.. Thanks!




  #3   Report Post  
Michael A
 
Posts: n/a
Default

ok, here is what I have so far.. im sure this isnt right. i get an
application or user defined error.. could someone help me improve this? Or am
off in left field.


Sub check_several_matches()
Dim i As Integer
Dim check As Boolean
check = True
For i = 1 To 3
If Sheets(7).Cells(1, i) < Sheets(8).Cells(1, i) Then
check = False
Exit For
End If
Next i
If check = True Then Copy Sheets(8).Cells(1, 7)
End Sub


"Michael A" wrote:

Ok, first of all, this community has been so great, and I wanted to thank you
all. I have a new thing i need to do, and i was wanting to see if anyone can
help me.

I need a macro that will look at the information on the current sheet, and
compare it to the information on the previous sheet and copy a value.
here is what i need

If any value on the current sheet in column A B and C matches anything on
the previous sheet in column A B and C (The line needs to have all 3 match),
then the macro would copy the value in the G column to the new page.


For example
Sheet 13
A B C G

Cat Dog Cat Not a Moose


then when the macro finds the same ABC on the new sheet, it fills in G for
me.

any help would be great.. Thanks!


  #4   Report Post  
Michael A
 
Posts: n/a
Default

Max, thanks for the reply, I dont think a formula would work in this
instance. There is over 400 different entries on each sheet, and over 70 of
them are duplicates from the sheet before, so the ones that arent duplicates
on the new sheet, would need to have the G column filled out manualy. I have
one sheet for each day of the month that I have to go in and do this for
every day.



"Max" wrote:

Perhaps a formulas approach might also work ?

Assume your source sheet is Sheet1,
cols A to C, with answers in col G,
data from row2 down

Cat Dog Cat Not a Moose
Cat Cat Cat Definitely a Cat
Cat Cat Dog Not a Moose2
etc

Answers: "Not a Moose", "Definitely a Cat", etc are in col G

Assume that Sheet2 will be the inputs sheet,
where the corresponding inputs below will be made
in cols A to C, row2 down:

Cat Dog Cat
Cat Cat Cat
Cat Cat Dog
etc

In Sheet3
------------
Assume col A is where we want the answers to be

Put in the formula bar for A2:

=IF(COUNTBLANK(Sheet2!A2:C2)<0,"",IF(ISNA(MATCH(S heet2!A2&Sheet2!B2&Sheet2!
C2,Sheet1!A2:A100&Sheet1!B2:B100&Sheet1!C2:C100,0) ),"",INDEX(Sheet1!G2:G100,
MATCH(Sheet2!A2&Sheet2!B2&Sheet2!C2,Sheet1!A2:A100 &Sheet1!B2:B100&Sheet1!C2:
C100,0))))

Array-enter the formula, i.e. press CTRL+SHIFT+ENTER
instead of just pressing ENTER

Copy A2 down to A100
(can copy down ahead of expected inputs in Sheet2)

Col A will return the corresponding results from col G in Sheet1 for the
inputs made in Sheet2's cols A to C matched against the source data in
Sheet1's cols A to C

If the inputs in cols A to C in Sheet2 are incomplete, or the inputs made do
not match with what's in Sheet1, blanks: "" will be returned

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Michael A" wrote in message
...
Ok, first of all, this community has been so great, and I wanted to thank

you
all. I have a new thing i need to do, and i was wanting to see if anyone

can
help me.

I need a macro that will look at the information on the current sheet, and
compare it to the information on the previous sheet and copy a value.
here is what i need

If any value on the current sheet in column A B and C matches anything on
the previous sheet in column A B and C (The line needs to have all 3

match),
then the macro would copy the value in the G column to the new page.


For example
Sheet 13
A B C G

Cat Dog Cat Not a Moose


then when the macro finds the same ABC on the new sheet, it fills in G for
me.

any help would be great.. Thanks!





  #5   Report Post  
Max
 
Posts: n/a
Default

You're welcome, Michael
Thanks for the feedback ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Michael A" wrote in message
...
Max, thanks for the reply, I dont think a formula would work in this
instance. There is over 400 different entries on each sheet, and over 70

of
them are duplicates from the sheet before, so the ones that arent

duplicates
on the new sheet, would need to have the G column filled out manualy. I

have
one sheet for each day of the month that I have to go in and do this for
every day.



"Max" wrote:

Perhaps a formulas approach might also work ?

Assume your source sheet is Sheet1,
cols A to C, with answers in col G,
data from row2 down

Cat Dog Cat Not a Moose
Cat Cat Cat Definitely a Cat
Cat Cat Dog Not a Moose2
etc

Answers: "Not a Moose", "Definitely a Cat", etc are in col G

Assume that Sheet2 will be the inputs sheet,
where the corresponding inputs below will be made
in cols A to C, row2 down:

Cat Dog Cat
Cat Cat Cat
Cat Cat Dog
etc

In Sheet3
------------
Assume col A is where we want the answers to be

Put in the formula bar for A2:


=IF(COUNTBLANK(Sheet2!A2:C2)<0,"",IF(ISNA(MATCH(S heet2!A2&Sheet2!B2&Sheet2!

C2,Sheet1!A2:A100&Sheet1!B2:B100&Sheet1!C2:C100,0) ),"",INDEX(Sheet1!G2:G100,

MATCH(Sheet2!A2&Sheet2!B2&Sheet2!C2,Sheet1!A2:A100 &Sheet1!B2:B100&Sheet1!C2:
C100,0))))

Array-enter the formula, i.e. press CTRL+SHIFT+ENTER
instead of just pressing ENTER

Copy A2 down to A100
(can copy down ahead of expected inputs in Sheet2)

Col A will return the corresponding results from col G in Sheet1 for the
inputs made in Sheet2's cols A to C matched against the source data in
Sheet1's cols A to C

If the inputs in cols A to C in Sheet2 are incomplete, or the inputs

made do
not match with what's in Sheet1, blanks: "" will be returned

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Michael A" wrote in message
...
Ok, first of all, this community has been so great, and I wanted to

thank
you
all. I have a new thing i need to do, and i was wanting to see if

anyone
can
help me.

I need a macro that will look at the information on the current sheet,

and
compare it to the information on the previous sheet and copy a value.
here is what i need

If any value on the current sheet in column A B and C matches anything

on
the previous sheet in column A B and C (The line needs to have all 3

match),
then the macro would copy the value in the G column to the new page.


For example
Sheet 13
A B C G

Cat Dog Cat Not a Moose


then when the macro finds the same ABC on the new sheet, it fills in G

for
me.

any help would be great.. Thanks!









  #6   Report Post  
Max
 
Posts: n/a
Default

Oops, sorry, this is just for the records ..
(forgot to fix the range references for the array formula in A2)

Put instead in the formula bar for A2:

=IF(COUNTBLANK(Sheet2!A2:C2)<0,"",IF(ISNA(MATCH(S heet2!A2&Sheet2!B2&Sheet2!
C2,Sheet1!$A$2:$A$100&Sheet1!$B$2:$B$100&Sheet1!$C $2:$C$100,0)),"",INDEX(She
et1!$G$2:$G$100,MATCH(Sheet2!A2&Sheet2!B2&Sheet2!C 2,Sheet1!$A$2:$A$100&Sheet
1!$B$2:$B$100&Sheet1!$C$2:$C$100,0))))

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


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
Copying Text to Clip Board Using a Macro robertguy Excel Discussion (Misc queries) 3 February 17th 05 01:11 AM
Copying a workbook with custom toolbar assigned to a macro Matt W Excel Discussion (Misc queries) 1 February 4th 05 10:46 PM
Finding duplicate records in Excel KG Excel Discussion (Misc queries) 2 December 22nd 04 07:44 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM
copying text into a macro pagelocator Excel Worksheet Functions 1 November 24th 04 08:52 AM


All times are GMT +1. The time now is 10:54 PM.

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

About Us

"It's about Microsoft Excel"