Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
changeable
 
Posts: n/a
Default Multiple Vlookup?


Hi i have somedata that looks like this(sorry, i dont know how to
display my xlsheet here, so i choose to display it by graphic) :
[image: http://img.photobucket.com/albums/v5...able/data.jpg]
How can i assign an ID for each row to a columns next to the Column G
if the column E and column F had match certain defined criteria?
This is how the criteria looks like:
[image:
http://img.photobucket.com/albums/v5.../criteria.jpg]
For example: Row 3 matched the criteria of Row 10866 since E3 is bigger
than 3.121694 but smaller than 3.122874. Due to this reason, i need to
place and ID "26" at H3. Similary, if others row in my database(1st
picture) that matched some of the criteria , says, criteria 31(not
shown in pic 2 but it is designed in that format), a 31 should place in
the H columns of the corresponding rows.

I have thought that this is a multiple criteria vlookup problem.
However, i dont have the experience in using Vlookup function.
Therefore, i try to achieve the same thing using this code (the
attached picture is what the code reference to):



code:
--------------------------------------------------------------------------------
Sub ID()
Dim i As Integer
Dim j As Integer
Dim coordinate As Variant
Dim criteria As Variant
Set coordinate = Range("E2:F131")
Set criteria = Range("J2:N128")
For i = 1 To 130
For j = 1 To 127
If coordinate(i, 1) = criteria(j, 2) And coordinate(i, 1) =
criteria(j, 3) Then
Cells(i, 9).Value = criteria(j, 1)
ElseIf coordinate(i, 1) = criteria(j, 2) And coordinate(i, 2) =
criteria(j, 5) Then
Cells(i, 9).Value = criteria(j, 1)
ElseIf coordinate(i, 1) = criteria(j, 3) And coordinate(i, 2) =
criteria(j, 4) Then
Cells(i, 9).Value = criteria(j, 1)
ElseIf coordinate(i, 2) = criteria(j, 4) And coordinate(i, 2) =
criteria(j, 5) Then
Cells(i, 9).Value = criteria(j, 1)
End If
Next j
Next i

End Sub
--------------------------------------------------------------------------------


However, i donno what's wrong with my code here too. (I have never
heard of VBA 10 days ago and dont have programming background). Hope
someone can tell me. Thanks.
[image: http://img.photobucket.com/albums/v5...eable/vba.jpg]

attached is my xlsheet. I dont know if this will help or not, but i
choose to attached the xlsheet here.

finally, pls forgive my bad english. Thanks


+-------------------------------------------------------------------+
|Filename: testing.zip |
|Download: http://www.excelforum.com/attachment.php?postid=2768 |
+-------------------------------------------------------------------+

--
changeable
------------------------------------------------------------------------
changeable's Profile: http://www.excelforum.com/member.php...o&userid=15714
View this thread: http://www.excelforum.com/showthread...hreadid=276546

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
XML / parent with multiple children and with multiple children Richard Excel Discussion (Misc queries) 0 January 5th 05 11:49 AM
How do I avoid saving multiple Excel/Wordfiles for versioning purp Neil Excel Discussion (Misc queries) 1 December 13th 04 12:57 PM
Can vlookup return multiple matches in a single cell? cchristensen Excel Discussion (Misc queries) 3 December 2nd 04 01:56 AM
Need help with modifying VLookUp Tom Excel Discussion (Misc queries) 4 December 2nd 04 12:44 AM
multiple vlookup choice Excel Worksheet Functions 2 November 1st 04 06:55 PM


All times are GMT +1. The time now is 10:56 AM.

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"