Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I have a set of data that alternates names and numbers within a row. For
example: Smith, 7, Jones, 5, Peters, 2, etc. I'm trying to pull out of each row the name associated with a specified number. So if the specified number is 2 in the example, I want the name Peters pulled out. The numbers are unique within each row, so there will be only one possible choice. I got a partial solution using the formula =MATCH(2,J3:AA3,0). This returns the position in the range where the number 2 is found. But I've been unable to display the name just before the 2 in the row. I tried OFFSET, but couldn't get it to work right. I would appreciate any help. Using Excel 97. Ken |
#3
![]() |
|||
|
|||
![]()
One way ..
Assume the data below is in J3:O3 : Smith, 7, Jones, 5, Peters, 2 (etc) Put in say, K2: =OFFSET($J$3,,MATCH(J2,$J$3:$AA$3,0)-2) Input the number in J2 If J2 contains: 2, K2 will return: Peter Input 7 in J2, K2 returns: Smith Perhaps better with an error trap, put instead in K2: =IF(ISNA(MATCH(J2,$J$3:$AA$3,0)),"",OFFSET($J$3,,M ATCH(J2,$J$3:$AA$3,0)-2)) which'll return blank: "" for any unmatched numbers -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- "Ken Schmidt" wrote in message ink.net... I have a set of data that alternates names and numbers within a row. For example: Smith, 7, Jones, 5, Peters, 2, etc. I'm trying to pull out of each row the name associated with a specified number. So if the specified number is 2 in the example, I want the name Peters pulled out. The numbers are unique within each row, so there will be only one possible choice. I got a partial solution using the formula =MATCH(2,J3:AA3,0). This returns the position in the range where the number 2 is found. But I've been unable to display the name just before the 2 in the row. I tried OFFSET, but couldn't get it to work right. I would appreciate any help. Using Excel 97. Ken |
#4
![]() |
|||
|
|||
![]()
Minor typo:
If J2 contains: 2, K2 will return: Peter "Peter" should read as "Peters" in the above line -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- |
#5
![]() |
|||
|
|||
![]()
Max:
Your formula worked. Thank you very much! Ken Max wrote in message ... One way .. Assume the data below is in J3:O3 : Smith, 7, Jones, 5, Peters, 2 (etc) Put in say, K2: =OFFSET($J$3,,MATCH(J2,$J$3:$AA$3,0)-2) Input the number in J2 If J2 contains: 2, K2 will return: Peter Input 7 in J2, K2 returns: Smith Perhaps better with an error trap, put instead in K2: =IF(ISNA(MATCH(J2,$J$3:$AA$3,0)),"",OFFSET($J$3,,M ATCH(J2,$J$3:$AA$3,0)-2)) which'll return blank: "" for any unmatched numbers -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- "Ken Schmidt" wrote in message ink.net... I have a set of data that alternates names and numbers within a row. For example: Smith, 7, Jones, 5, Peters, 2, etc. I'm trying to pull out of each row the name associated with a specified number. So if the specified number is 2 in the example, I want the name Peters pulled out. The numbers are unique within each row, so there will be only one possible choice. I got a partial solution using the formula =MATCH(2,J3:AA3,0). This returns the position in the range where the number 2 is found. But I've been unable to display the name just before the 2 in the row. I tried OFFSET, but couldn't get it to work right. I would appreciate any help. Using Excel 97. Ken |
#6
![]() |
|||
|
|||
![]()
Glad to hear, Ken !
Thanks for the feedback -- Rgds Max xl 97 --- GMT+8, 1° 22' N 103° 45' E xdemechanik <atyahoo<dotcom ---- "Ken Schmidt" wrote in message nk.net... Max: Your formula worked. Thank you very much! Ken |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Seed numbers for random number generation, uniform distribution | Excel Discussion (Misc queries) | |||
#VALUE in cell but pop up function box show right number | Excel Discussion (Misc queries) | |||
excel format cells/Number/Category: Number problem | Excel Discussion (Misc queries) | |||
Use Julian Date To Create Serial Number | Excel Discussion (Misc queries) | |||
Lookup closest number in list | Excel Discussion (Misc queries) |