Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dear Friends, I need code for to find the record through macth command instead of vlookup command. It is because the data is not in a sort order, and i don't want to change the sorting order of the original data. When the data found then select the 3rd col of the row in a textbox1. Thanks in advance Syed Haider Ali -- Syed Haider Ali ------------------------------------------------------------------------ Syed Haider Ali's Profile: http://www.excelforum.com/member.php...o&userid=21994 View this thread: http://www.excelforum.com/showthread...hreadid=397469 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use =vlookup() with data that isn't sorted. Just make sure you specify
False as the 4th argument. =vlookup(a1,sheet2!a:d,3,false) In code... dim res as variant dim myLookupRange as range dim myCell as range set mycell = worksheets("sheet1").range("a1") set mylookuprange = worksheets("sheet2").range("A:D") res = application.vlookup(mycell.value, mylookuprange,3,false) if iserror(res) then 'not found else msgbox res end if ==== I'm not sure what the 3rd column of the row in a textbox1 means. Syed Haider Ali wrote: Dear Friends, I need code for to find the record through macth command instead of vlookup command. It is because the data is not in a sort order, and i don't want to change the sorting order of the original data. When the data found then select the 3rd col of the row in a textbox1. Thanks in advance Syed Haider Ali -- Syed Haider Ali ------------------------------------------------------------------------ Syed Haider Ali's Profile: http://www.excelforum.com/member.php...o&userid=21994 View this thread: http://www.excelforum.com/showthread...hreadid=397469 -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
U can use match function to index the column within vlookup as follows
suppose your data range is b2:g10 b2:g2 is a header for your table, col b is first colum in the table. let's say that your header has a column labeled col3 and that xyz is a record listed in the first column of your table. vlookup () requires that first column in data range has record u r looking up, this is the row anchor. u can combine the match function to identify the column within the vlookup function as below: =VLOOKUP("xyz", B2:G10, MATCH("col3",B2:G2,0),FALSE) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to get a decimal point using Match command | Excel Discussion (Misc queries) | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
QUESTION with Match command and OFFSET | Excel Programming | |||
I want to combine a "match" command with a copy and paste command. | Excel Programming | |||
How Do I Expand A Set Range In The Match Command | Excel Programming |