Solved

Lookup table

Posted on 2004-03-25
4
519 Views
Last Modified: 2012-06-22
Please help (once again...!)
I need to retrieve an element from a cell block but cannot get it right.

I have the following on an EXCEL worksheet

V7      P7      W7      P4      L7
AES      ZZA      MMG      IVB      MMA
IID      ZZB      MMH      IVF      MMB
IIG      ZZC      MMI      IVI      MMC
IIJ            MMJ      IVM      MMD
IIK            MMK      IVO      MME
IIN            MML      IVR      MMF
IIS            MMM      IVS      
IIT            MMN      IVW      
IIU            MMO      IVX      
IIV            MMP      IVY      
IIW                  IVZ      
IIX                  NLE      
IIY                  NLF      
                  NLK      
                  NLN      
                  NLO      
                  NLP      
                  NLS      
                  NLT      
                  NLV      
                  NLW      
                  NLX      
                  NLY      
                  NLZ      
                  YGB      
                  YGE      
                        
                        
                        
                        
                        
The data being supplied is one of the values AES, IVX etc. etc. and what I want is the value at the top of the appropriarte column (ie one of P4, W7, P7 etc.)
How do I use the appropriate lookup and reference functions to extract the value at the top of the column, given the value supplied.
Note that the number of values in each column is not constant and that the values are not in sorted order, although this could be done if it makes the solution easier.

Big points available for the first person to get it right
0
Comment
Question by:GSD4ME
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 10680112
I don't know excel well enough to provide the solution, but I can give you a quick logic approach that you can try.

Find the item that you are looking for.  I would guess that Excel provides a find function that returns a cell.

When you know the cell that you are in then you need to look in the first row of the same colum to get it's value.

Of course what I'm saying may be what you already know.
0
 
LVL 5

Assisted Solution

by:g0rath
g0rath earned 250 total points
ID: 10680562
Dim SearchRange as Excel.Range
Dim FoundCell as Excel.Range

Set SearchRange = ThisWorkbook.Worksheet("Sheet1").UsedRange
Set FoundCell = SearchRange.Find("Hello")

Then you can do stuff like

Set FoundCell = SearchRange.FindNext

etc etc...

0
 
LVL 1

Accepted Solution

by:
MADisonMAN earned 250 total points
ID: 10681833
In addition to g0rath you can do like that. Put this code in a macro and call. You need to call everytime for each supplied value. Hope this helps you more.

Dim SearchRange As Excel.Range
Dim FoundCell As Excel.Range
Dim SuppliedValue As String

SuppliedValue = InputBox("Enter Cell Value to Find")
Set SearchRange = ThisWorkbook.Worksheets("Sheet1").UsedRange
Set FoundCell = SearchRange.Find(SuppliedValue)


'MsgBox FoundCell.Address
'MsgBox FoundCell.Column
MsgBox FoundCell.EntireColumn.Cells(1, 1).Value

FoundCell.EntireColumn.Cells(1, 1).Activate
0
 

Author Comment

by:GSD4ME
ID: 10688981
Thanks to the pair of you for the answer - exactly what I wanted.
Points have been split evenly
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question