PC Review


Reply
Thread Tools Rate Thread

Data entry and lookup

 
 
=?Utf-8?B?RHVhbmU=?=
Guest
Posts: n/a
 
      16th Oct 2007
I would like to create an Excel form in which I can enter a value into a
cell, and that value would be replaced by a different value taken from a
table. For instance, if I type in the value 102 in cell A1, then cell A1
would display the string "Text 3" which would be obtained from column two of
Table 1. Other values for A1 would be substituted similarly with the values
from Column 2, based on the value of Column 1.

Table 1

Column 1 Column 2
100 Text 1
101 Text 2
102 Text 3
103 Text 4
104 Text 5

I have seen the Match and Lookup commands used to do these sorts of things.
However, in the examples that I have seen, the value that is used to look up
the value in column 2 is incorporated into the formula; i.e., it is a fixed
value. Is there a way to use these or other commands to accept the value
entered into the cell as the value to use in the lookup process to return a
different value for the cell?

I am new to this so is this something that is best acheived using VBA, one
of Excel's built in macros, or ?? Finally, is there a good reference article
or book for people that don't do much programming that describes how to do
these sorts of things.

Much thanks!

--
Duane
 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      16th Oct 2007
Duane

You would need event code to return a different value to a cell in which you
type something.

Generally you would use a second cell to return a value based upon what you
typed into the first cell.

That's where the VLOOKUP or MATCH functions come into play.

VLOOKUP formulas will pull the data to appropriate cells.

See Debra Dalgleish's site for more on VLOOKUP and Data
Validation lists for entering the choices.

http://www.contextures.on.ca/xlFunctions02.html

http://www.contextures.on.ca/xlDataVal01.html

Note the section on using DV lists from another worksheet by naming the list.


Gord Dibben MS Excel MVP

On Tue, 16 Oct 2007 11:05:01 -0700, Duane <(E-Mail Removed)>
wrote:

>I would like to create an Excel form in which I can enter a value into a
>cell, and that value would be replaced by a different value taken from a
>table. For instance, if I type in the value 102 in cell A1, then cell A1
>would display the string "Text 3" which would be obtained from column two of
>Table 1. Other values for A1 would be substituted similarly with the values
>from Column 2, based on the value of Column 1.
>
>Table 1
>
>Column 1 Column 2
>100 Text 1
>101 Text 2
>102 Text 3
>103 Text 4
>104 Text 5
>
>I have seen the Match and Lookup commands used to do these sorts of things.
>However, in the examples that I have seen, the value that is used to look up
>the value in column 2 is incorporated into the formula; i.e., it is a fixed
>value. Is there a way to use these or other commands to accept the value
>entered into the cell as the value to use in the lookup process to return a
>different value for the cell?
>
>I am new to this so is this something that is best acheived using VBA, one
>of Excel's built in macros, or ?? Finally, is there a good reference article
>or book for people that don't do much programming that describes how to do
>these sorts of things.
>
>Much thanks!


 
Reply With Quote
 
excel-ant
Guest
Posts: n/a
 
      16th Oct 2007
Yep. You would need to add a change event macro to run in the
spreadsheet to update the value of the cell using a Lookup formula.
Alternatively you could click a button to perform this operation.
I have uploaded an example spreadsheet.

http://somethinglikeant.110mb.com//e.../examples/Data entry and
lookup Options.xls

Code is (Press Alt +F11)

Sub ChangeItem()

Set qrange = Range("B:C")
[A1] = Application.WorksheetFunction.VLookup([A1], qrange, 2, 0)

End Sub

Hope this helps

Anthony
http://www.excel-ant.co.uk

 
Reply With Quote
 
=?Utf-8?B?RHVhbmU=?=
Guest
Posts: n/a
 
      23rd Oct 2007
Thanks Gord and excel-ant! Your responses are very helpful!

Duane
--
Duane


"excel-ant" wrote:

> Yep. You would need to add a change event macro to run in the
> spreadsheet to update the value of the cell using a Lookup formula.
> Alternatively you could click a button to perform this operation.
> I have uploaded an example spreadsheet.
>
> http://somethinglikeant.110mb.com//e.../examples/Data entry and
> lookup Options.xls
>
> Code is (Press Alt +F11)
>
> Sub ChangeItem()
>
> Set qrange = Range("B:C")
> [A1] = Application.WorksheetFunction.VLookup([A1], qrange, 2, 0)
>
> End Sub
>
> Hope this helps
>
> Anthony
> http://www.excel-ant.co.uk
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use a form for both lookup and new data entry rmccafferty Microsoft Access Forms 0 8th Sep 2009 04:36 PM
Data Entry, lookup existing John Keith Microsoft Access VBA Modules 2 12th Jan 2009 04:59 PM
Data Entry using Auto Lookup query & Data Entry Form Bob N Microsoft Access Forms 3 28th Oct 2008 07:43 PM
data lookup from a form entry Steve Microsoft Access Forms 4 1st Oct 2008 06:01 PM
Data entry property & lookup =?Utf-8?B?TWFhcmty?= Microsoft Access Forms 6 18th Oct 2007 03:34 PM


Features
 

Advertising
 

Newsgroups
 


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