Search code examples
arraysgoogle-sheetsgoogle-sheets-formulavlookupflatten

Is there a more efficient way of entering the function I’ve used for assigning scores in a voting survey?


Cells showing votes, with slight view of table above

Collated scores/votes where function is used

Is there a more efficient method of entering the function shown here to assign scores for each persons choices? I have a working function but it’s labour intensive the way it’s written.

=switch(B3:B62,B65,"20",B66,"19",B67,"18",B68,"17",B69,"16",B70,"15",B71,"14",B72,"13",B73,"12",B74,"11",B75,"10",B76,"9",B77,"8",B78,"7",B79,"6",B80,"5",B81,"4",B82,"3",B83,"2",B84,"1","0")

Each person votes for their top 20 with scores assigned 20-1 in descending order. The function takes these votes/scores for each person lower down and totals in the table at top of the page.

My knowledge of sheets/functions is limited to what I’ve learnt creating this, but I figure there’s a better way than what I have done, so apologies if this is a bit of a basic request.


Solution

  • delete everything in E3:O62 and use this in E3:

    =ARRAYFORMULA(IFNA(VLOOKUP(C3:C62&E2:O2, {C64:C&
     VLOOKUP(ROW(A64:A), IF(A64:A="Pos.", {ROW(A64:A), C64:C}), 2, 1), 
     IFERROR(21-A64:A)}, 2, 0), 0))
    

    enter image description here