问题
In Google Sheets, I have a table with dynamic cells that count the number of occurrences in a feed from Google Forms. At the left, in Column A there are names of items, and the columns at the right count how many times they are listed in the responses from the forms, so this values change as more responses are added. I am trying to make a report that mentions which item had the most instances per column.
The formula I used initially works:
=INDEX(INDIRECT("A$3:A$6"), 1, MATCH(MAX(B3:B6), B3:B6, 0))
But when I move it to count on other columns it gives a #NUM error (value 4 of the parameter 3 is out of range), like:
=INDEX(INDIRECT("A$3:A$6"), 1, MATCH(MAX(E3:E6), E3:E6, 0))
(even if I change the "1" or the "0" on the formula to match the column number the error persists)
I also found the problem of 2 rows having the same value...or all of them not having data yet and all are "0".
Can anyone see where exactly is the error or have an idea on how to deal with repeated values? (I considered using an IF to name all repeated values unless they are 0, in which case it could display a 'none found' message, but I'm not sure how to implement it.)
I checked these:
- https://webapps.stackexchange.com/questions/59293/find-cell-with-highest-value-of-a-cell-range
- Google Sheets: selecting cell values based on another cell MAX values
Example sheet (Tab1 is data and tab2 is where the formulas are. The ones of this question are in row 9 with 2 possible formulas I tried) is here: https://docs.google.com/spreadsheets/d/1h8_K7nb82hJkDsmUpn6iSkZXhnYEo1NRC2LmRKochgw/edit?usp=sharing .
I tried 2 formulas:
Formula 1 (B9 - It gives the #NUM! error):
=INDEX(INDIRECT("A$3:A$6"), 1, MATCH(MAX(B3:B6), B3:B6, 0))
Formula 2 (C9- Gives #ERROR!):
=INDEX(INDIRECT("A$3:A$6"), 1, IF(C3:C6>0,"MATCH(MAX(C3:C6), C3:C6, "0","NO VALUES"))
The second formula was supposed to fix the 0 value problem by only comparing if the values are >0, else show "NO VALUES" message.
回答1:
paste in B9 and drag to the right:
=INDIRECT("A"&MATCH(MAX(B3:B6), B1:B6, 0))
for C9 you can use:
=IFNA(INDIRECT("A"&MATCH(IF(MAX(C3:C6)<>0, MAX(C3:C6), "♥") , C1:C6, 0)), "no values")
来源:https://stackoverflow.com/questions/58633597/return-cell-content-based-on-max-value-of-other-column-in-google-sheets