My team has to fill in their schedules in google forms each week, and basically I'm trying to do it so if they select "Maintain," I can automatically pull their last/previously filled entry.
So far I've gotten this:
=if(D23="Maintain",(INDEX('Form Responses'!$E$2:$R,MATCH($C23,'Form Responses'!$B$2:$B)-1)),(INDEX('Form Responses'!$E$2:$R,MAX(IF('Form Responses'!$B$2:$B=C23,ROW(C:C))))))
but the "True" section isn't returning the right row (with or without the "-1").
The name "JC" is supposed to show the data from row32 in the responses sheet, and "NA" is supposed to return that of row40.
The "-1" is supposed to Index/Match the second-to-last entry with that specific name, but I can't tell if it's working correctly or not.
What am I doing wrong with the "True" portion?
Sample sheet: https://docs.google.com/spreadsheets/d/1FeYzXH3spqKqZAZWpKO0PFMdYuTjrtDoZIxlW50B-ns/edit#gid=1728521224
delete everything in E3:R range and use in E3:
=ARRAYFORMULA(IFNA(IF(D3:D="Maintain",
VLOOKUP(C3:C, QUERY(SORT('Form Responses'!B2:R, ROW('Form Responses'!B2:B), 0),
"where not Col2 = 'Maintain' and Col1 is not null", 0), COLUMN(D:Q), 0),
VLOOKUP(C3:C, SORT('Form Responses'!B2:R, ROW('Form Responses'!B2:B), 0), COLUMN(D:Q), 0))))