+ Reply to Thread
Results 1 to 7 of 7

An array formula to lookup two values and produce a total score

  1. #1
    Registered User
    Join Date
    11-19-2009
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    21

    An array formula to lookup two values and produce a total score

    Hello all,

    I have a table of data where each row is a person, and each column is a group that person might belong to. In the intersecting cell of a person row and group column is text showing what position they hold in that group (eg Director, Head, member etc). In many cases the cell is empty because the person is not involved with the group.

    There are then two lookup tables which have scores; one for the group name and one for the position type. The group name is always the column header. I have used these lookup tables as I would like the scores for each group or position to be easily adjustable.

    Probably best that I just attach an example. I tried to solve this using SUMPRODUCT. VLOOKUP on the two lookup tables would have been good but it seems it doesn't work with arrays the way I expected. My attempt (which doesn't work obviously!) is given.

    Many thanks,

    Tom
    Attached Files Attached Files
    Last edited by t_e_k; 11-19-2009 at 10:06 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: An array formula to lookup two values and produce a total score

    Based on your file

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-19-2009
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: An array formula to lookup two values and produce a total score

    Hi DonkeyOte,

    Thanks for the very quick response!

    This forumla is giving me values of TRUE in the score column C. (I didnt even know SUMPRODUCT could return a TRUE?)

    Anyway, what I was actually hoping for was the summed scores as shown in column H. So;

    C2 = 26
    C3 = 4
    C4 = 30

    Thank you.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: An array formula to lookup two values and produce a total score

    The formula provided, when entered into C2 (and copied down) generates 26,4,30 respectively (else I would not have posted it).

  5. #5
    Registered User
    Join Date
    11-19-2009
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: An array formula to lookup two values and produce a total score

    Sorry, I though I must not have explained myself clearly!

    (I had managed to paste the formula into the cell twice. Oops.)

    Thanks for your help.

  6. #6
    Registered User
    Join Date
    11-19-2009
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: An array formula to lookup two values and produce a total score

    Amazingly neat solution by the way, I am still trying to get my head round using arrays and SUMPRODUCT. I think I will read through some of the links in your signature.

    Thanks.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: An array formula to lookup two values and produce a total score

    Bob Phillips' white paper (Sumproduct link) is an excellent tutorial on the function (the best around IMO) and also elaborates on coercion etc...

    Regards your earlier point:

    Quote Originally Posted by t_e_k
    VLOOKUP on the two lookup tables would have been good but it seems it doesn't work with arrays the way I expected.
    Correct, VLOOKUP won't work ... an alternative is to use LOOKUP but this would fail to work correctly if either

    a) the data was not sorted (ascending)

    OR

    b) any given criteria value was not listed in the lookup range (eg your blanks)

    on that basis the SUMIF is therefore the simpler approach given it will handle both unsorted lookup range and simply return 0 for no match (as opposed to error).
    Last edited by DonkeyOte; 11-19-2009 at 07:10 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1