Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Lookup table

Posted on 2004-03-25
4
Medium Priority
?
522 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 1000 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

719 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