Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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! |
#4
![]() |
|||
|
|||
![]()
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! |
#5
![]() |
|||
|
|||
![]()
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 ---- |
#6
![]() |
|||
|
|||
![]()
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying Text to Clip Board Using a Macro | Excel Discussion (Misc queries) | |||
Copying a workbook with custom toolbar assigned to a macro | Excel Discussion (Misc queries) | |||
Finding duplicate records in Excel | Excel Discussion (Misc queries) | |||
2 questions, copying data from sheet to sheet and assigning macro | Excel Worksheet Functions | |||
copying text into a macro | Excel Worksheet Functions |