Solved

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

Posted on 2012-03-18
3
305 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 100 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 400 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
 
LVL 2

Author Comment

by:mcnuttlaw
ID: 37737735
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

726 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