Feeds:
Posts
Comments

Archive for July, 2010

Consider this problem

The table above gives the groups in which each of the members belong. the problem here is to find out in which group one of the member belongs to e.g. Keith (A12). The formula used in B12 is

=INDEX($A$1:$C$1,1,SUMPRODUCT(- –ISNUMBER(SEARCH(A12,$A$2:$C$8)),{1,2,3}*{1;1;1;1;1;1;1}))

The way this works is

  • Search function searches for Keith (A12) in the array A2:C8. It returns #VALUE! for cells where Keith is not present and 1 for the cell in which Keith is present
  • Isnumber returns True for the cell in which Keith is present and False for the rest
  • Operator – – changes True and False to numbers 1 and 0 respectively
  • Thus we have an array of 0s and one 1 with 7 rows and 3 columns
  • We now generate an array with {1,2,3}*{1;1;1;1;1;1;1}. This array is of the form

  • Sumproduct multiplies the earlier generated array of 0 and 1 with our array such that it returns the column number of cell in which Keith is present – 2 in this case
  • Index simply returns the equivalent group from the header array A1:C1 – Lions in this case.

Can you figure out a way of not putting the array manually by using the function row and column functions.

Read Full Post »