Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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.

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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
If statement or lookup statement not sure Renegade40 Excel Worksheet Functions 2 January 18th 09 06:11 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 11:16 AM.

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"