Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ken Schmidt
 
Posts: n/a
Default Name associated with a number

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   Report Post  
Max
 
Posts: n/a
Default

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   Report Post  
Max
 
Posts: n/a
Default

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   Report Post  
Ken Schmidt
 
Posts: n/a
Default

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   Report Post  
Max
 
Posts: n/a
Default

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
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
Seed numbers for random number generation, uniform distribution darebo Excel Discussion (Misc queries) 3 April 21st 23 09:02 PM
#VALUE in cell but pop up function box show right number Ted Dalton Excel Discussion (Misc queries) 1 December 14th 04 03:15 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM
Use Julian Date To Create Serial Number antho10359 Excel Discussion (Misc queries) 4 December 9th 04 01:50 AM
Lookup closest number in list Jeff Excel Discussion (Misc queries) 6 November 26th 04 07:27 PM


All times are GMT +1. The time now is 05:13 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"