Company News Products Projects Texts Museum Download Contact Map RSS Polski
YAC Software Texts Searching for Values in 2D Tables Trybiks' Dive
  Back

List

Market Research in Poland - 2009

Nested randomized blocks

Names of variables in continuous surveys

Example of quota checking

Quotas in YAC Interview Kit

Handling missing data in filter expressions

SPSS Syntax Tips

noback vs. noret

Market Research in Poland - 2008

Searching for Values in 2D Tables

Effective Reach and Optimization

Referencing Cells in Excel

Open All and Merge

Market Research in Poland - 2007

Searching for Values in 2D Tables
Ok, so let's say that you have the following table:

A B C D E F G
1   a1 a2 b c1 c2 c3
2X1 1 2 3 4 5 6
3X2 7 8 9 101112
4Y11314151651718
5Y2192021 222324

and you want to search for values given a row id (here - X1 to Y2) and a column id (here - a1 to c3).

Two functions will help us here:
  • MATCH - returns the position of a value in an array or list,
  • INDEX - returns a value from a table, based on an index number.
MATCH will be used to find the row and column, then INDEX to find the value on the intersection of these two.

So, let's say that we're searching for the value in column b and row X2:
  • MATCH("b", B1:G1, 0) returns 3 (the third column of the table);
    the third parameter - 0 - means that we're looking for exact matches only (for "b"),
  • MATCH("X2", A2:A5, 0) returns 2 (the second row of the table),
Now, by using these two values in the INDEX function, we can get the sought value:

INDEX(B2:G5, MATCH("X2", A2:A5, 0), MATCH("b", B1:G1, 0)) returns... 9!
(Note that in Excel you pass the row as the first parameter, then the column.)

HTH

Top

Comments
#1
Mario wrote on 2009-02-25 10:37:23
Czesc :) widze ze przerzuciles sie na Excela :)

to wale poprawke (trzeba w index jeszcze podac zakres tabeli zeby bylo dobrze :)):
INDEX(B2:G5, MATCH("X2", A2:A5, 0), MATCH("b", B1:G1, 0))

Pozdro,
Mario
#2
trybik wrote on 2009-02-25 11:02:36
Dzięki!
Poprawione też w tek¶cie.

Top

Add a comment (fields with an asterisk are required)
Name / nick *
Mail (will remain hidden) *
Your website
Comment (no tags) *
Enter the text displayed below *
 

Top