Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Select an item from dropdown list but return value from adjacent c

What I would like to do is have an array of data in columns, the first column
being the Item, the second being the ID Number, etc. In a cell, I would like
to see a list of Items from which I can select, but once selected, I want to
return the ID Number into the cell. Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Select an item from dropdown list but return value from adjacent c

Try this:

A2:A10 = items
B2:B10 = ID numbers

Create a drop down list of the items:

Select cell E2
Goto the menu DataValidation
Allow: List
Source: =A2:A10
OK

Enter this formula in cell F2:

=IF(E2="","",VLOOKUP(E2,A2:B10,2,0))

Biff

"StevanT" wrote in message
...
What I would like to do is have an array of data in columns, the first
column
being the Item, the second being the ID Number, etc. In a cell, I would
like
to see a list of Items from which I can select, but once selected, I want
to
return the ID Number into the cell. Is this possible?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Select an item from dropdown list but return value from adjace

Biff,

Thanks for the quick response. Not exactly what I was after. What I wanted
to do is (using your example), select an item in cell E2, and then return the
required ID Number into E2, not into F2.
I know this was possible in Lotus 1-2-3, but can't find a similar function
in Excel.
I appreciate your help.

"T. Valko" wrote:

Try this:

A2:A10 = items
B2:B10 = ID numbers

Create a drop down list of the items:

Select cell E2
Goto the menu DataValidation
Allow: List
Source: =A2:A10
OK

Enter this formula in cell F2:

=IF(E2="","",VLOOKUP(E2,A2:B10,2,0))

Biff

"StevanT" wrote in message
...
What I would like to do is have an array of data in columns, the first
column
being the Item, the second being the ID Number, etc. In a cell, I would
like
to see a list of Items from which I can select, but once selected, I want
to
return the ID Number into the cell. Is this possible?




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Select an item from dropdown list but return value from adjace

I know this was possible in Lotus 1-2-3, but can't find a similar function
in Excel.


There is none. The only way this would be possible is to use VBA code. I
can't help you with that.

Biff

"StevanT" wrote in message
...
Biff,

Thanks for the quick response. Not exactly what I was after. What I
wanted
to do is (using your example), select an item in cell E2, and then return
the
required ID Number into E2, not into F2.
I know this was possible in Lotus 1-2-3, but can't find a similar function
in Excel.
I appreciate your help.

"T. Valko" wrote:

Try this:

A2:A10 = items
B2:B10 = ID numbers

Create a drop down list of the items:

Select cell E2
Goto the menu DataValidation
Allow: List
Source: =A2:A10
OK

Enter this formula in cell F2:

=IF(E2="","",VLOOKUP(E2,A2:B10,2,0))

Biff

"StevanT" wrote in message
...
What I would like to do is have an array of data in columns, the first
column
being the Item, the second being the ID Number, etc. In a cell, I
would
like
to see a list of Items from which I can select, but once selected, I
want
to
return the ID Number into the cell. Is this possible?






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Select an item from dropdown list but return value from adjace

I saved this from a previous post:

Personally, I'd use two cells. The cell with data|validation would contain the
long string and the adjacent(?) cell would contain the short string

Put the table in Sheet2 (long name in column A, short name in column B).

A1 has the data|validation cell
B1 has this formula:
=if(a1="","",vlookup(a1,sheet2!a:b,2,false)

Then I could use either cell in any other formulas.

But if you're using xl2k or higher (won't work in xl97), you could use the same
table and a worksheet_event that overwrites the value in the cell with the short
name.

You'll have to name that range in column A for Data|Validation to work with a
list on a different worksheet.

Debra Dalgleish explains it:
http://contextures.com/xlDataVal01.html#Name

If you want to try...

I used Sheet2 and created a list named myList.

Then right click on the worksheet tab that should have this behavior and select
view code. And paste this into the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim res As Variant
Dim myList As Range

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a1")) Is Nothing Then
Exit Sub
End If

If Target.Value = "" Then Exit Sub

Set myList = Worksheets("sheet2").Range("myList")
res = Application.Match(Target.Value, myList, 0)

If IsError(res) Then
'this shouldn't happen!
MsgBox "Something bad happened"
Else
Application.EnableEvents = False
Target.Value = myList(res, 2).Value
Application.EnableEvents = True
End If

End Sub


Then change "a1" to the cell that has the data|validation.

And back to excel to test it.


StevanT wrote:

Biff,

Thanks for the quick response. Not exactly what I was after. What I wanted
to do is (using your example), select an item in cell E2, and then return the
required ID Number into E2, not into F2.
I know this was possible in Lotus 1-2-3, but can't find a similar function
in Excel.
I appreciate your help.

"T. Valko" wrote:

Try this:

A2:A10 = items
B2:B10 = ID numbers

Create a drop down list of the items:

Select cell E2
Goto the menu DataValidation
Allow: List
Source: =A2:A10
OK

Enter this formula in cell F2:

=IF(E2="","",VLOOKUP(E2,A2:B10,2,0))

Biff

"StevanT" wrote in message
...
What I would like to do is have an array of data in columns, the first
column
being the Item, the second being the ID Number, etc. In a cell, I would
like
to see a list of Items from which I can select, but once selected, I want
to
return the ID Number into the cell. Is this possible?





--

Dave Peterson
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
select more than one item in list jen_writer Excel Discussion (Misc queries) 2 January 24th 07 09:12 PM
select multiple items from a dropdown list Rebecca1 Excel Worksheet Functions 0 July 17th 06 08:47 PM
Select chart series using dropdown list Alex Delamain Charts and Charting in Excel 2 August 31st 05 07:35 PM
How select an item in a list box jamie81 Excel Worksheet Functions 1 May 31st 05 09:53 AM
How can I set up to chose more than 1 item from a dropdown list (. microchick Excel Discussion (Misc queries) 4 April 7th 05 06:59 PM


All times are GMT +1. The time now is 10:03 PM.

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"