ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with a statement (https://www.excelbanter.com/excel-programming/377451-help-statement.html)

Help Needed!!!

Help with a statement
 
Help would be greatly appreciated. Example is below.

I need a statement that would do the following:

match a number within a column in sheet1 with several columns in sheet2 and
the results would import the matching number's row from sheet2 to sheet 1.

JMB

Help with a statement
 
where A1 is the number you're trying to find in Sheet2!A1:C13, try:

=MIN(IF(Sheet2!A1:C13=A1,ROW(Sheet2!A1:C13)))

array entered w/Cntrl+Shift+Enter. change ranges as needed (but cannot use
entire columns, such as A:C). it should give you the first row in which that
number appears.

or for the relative row reference
=MIN(IF(Sheet2!A1:C13=A1,ROW(Sheet2!A1:C13)-ROW(Sheet2!A1)+1))

(which makes no difference in this specific example since the data is in the
first row of Sheet2) also array entered.


"Help Needed!!!" wrote:

Help would be greatly appreciated. Example is below.

I need a statement that would do the following:

match a number within a column in sheet1 with several columns in sheet2 and
the results would import the matching number's row from sheet2 to sheet 1.


Help Needed!!![_2_]

Help with a statement
 
You gave me a better understanding. But here is what i am trying to do.

in sheet 1 column A row 1 through 20 there is numbers. i need to match the
number in sheet 1 column A row 1 thru 20 with the same number in sheet 2
column A row 1 through 20. if the number match (if the statement is true)
then copy/import the matching numbers row from sheet 2 to sheet 1.

I hope that is more clear. Thank you for your help.

"Help Needed!!!" wrote:

Help would be greatly appreciated. Example is below.

I need a statement that would do the following:

match a number within a column in sheet1 with several columns in sheet2 and
the results would import the matching number's row from sheet2 to sheet 1.


JMB

Help with a statement
 
Sorry for the misunderstanding. Try this macro (be sure to backup before):

Sub test()
Dim rngCell As Range
Dim rngDest As Range
Dim rngSource As Range
Dim rngMatch As Range

Set rngDest = Worksheets("Sheet1").Range("A1:A20")
Set rngSource = Worksheets("Sheet2").Range("A1:A20")

On Error Resume Next
For Each rngCell In rngDest.Cells
Set rngMatch = rngSource.Find(What:=rngCell.Value, _
After:=rngSource.Cells(1, 1), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not rngMatch Is Nothing Then _
rngMatch.EntireRow.Copy rngCell
Next rngCell


End Sub

"Help Needed!!!" wrote:

You gave me a better understanding. But here is what i am trying to do.

in sheet 1 column A row 1 through 20 there is numbers. i need to match the
number in sheet 1 column A row 1 thru 20 with the same number in sheet 2
column A row 1 through 20. if the number match (if the statement is true)
then copy/import the matching numbers row from sheet 2 to sheet 1.

I hope that is more clear. Thank you for your help.

"Help Needed!!!" wrote:

Help would be greatly appreciated. Example is below.

I need a statement that would do the following:

match a number within a column in sheet1 with several columns in sheet2 and
the results would import the matching number's row from sheet2 to sheet 1.



All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com