?
Solved

Search for a value in an array with multiple rows and columns

Posted on 2012-03-18
3
Medium Priority
?
316 Views
Last Modified: 2012-03-19
I need to search for a value in an array that has multiple rows and columns and return the value in the corresponding column/row.

In this screenshot,

Array would be the cells darkly shaded (C5:T8)
Return values in column B (B5:B8)

Search for 1 should return Course 2
Search for 2 should return Course 3

sample
0
Comment
Question by:mcnuttlaw
[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
3 Comments
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 400 total points
ID: 37734692
Paste the given function in a normal module and then use the formula

=alookup(2,B4:Q11)

Function alookup(r, ar As Range)
alookup = Cells(ar.Offset(1, 1).Find(r).Row, ar.Column)
End Function

See attached file
Alookup.xlsm
0
 
LVL 18

Accepted Solution

by:
krishnakrkc earned 1600 total points
ID: 37734867
Hi,

=IF(COUNTIF(C5:T8,C2),INDEX(B5:B8,MIN(IF(C5:T8=C2,ROW(B5:B8)-ROW(B5)+1))),"")

where C2 holds the number. It's an array formula. Conformed with CTRL + SHIFT + ENTER

Kris
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

800 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