3

Sheet in question: https://docs.google.com/spreadsheets/d/1-4ZS3ByIM4DeLhGH0-9_l0rR_vGm9lTb95zMsofJoeE/edit#gid=0

I have a query built already, I just need help applying it to all rows with an array formula vs. dragging it down.

I have two sheets: one is a table of job posts. The other is a table of potential applicants. Applicants have fields describing the types of jobs they want to get (such as category, experience level, etc.), and job posts have the same type of fields.

I want to match the two best applicants for each job, based on how many of their fields match the job post's fields.

I've figured out a query + array formula to rank applicants and show the best options, but now I need to use an array formula so we can get this result for every row instead of manually dragging it down as we add new rows.

The formula in question that I want to apply to all rows is on the Job posts sheet under E2.

The way it currently works is: For each job post row, the query creates a virtual table of all applicants with a virtual column that scores them. Using IF, I give them a point for each row that matches the job post criteria. Then the query sorts by their score and outputs their name and URL.

I then use "Limit 1" on the query so it only outputs the best match.

For second best, third best, etc. I use offset 1, 2, 3, etc.

Bonus points if you can help me transpose the results so that instead of setting up an identical query for 2nd place and so on, I can get all the results from one query along one row. That's less important than having this apply to all rows though.

6
  • do you want person2 even if that person's score is 1? Commented Nov 9, 2021 at 20:22
  • Just for clarification, is this sample image your desired output? Commented Nov 9, 2021 at 21:05
  • @player0 it doesn't matter what the score is. Commented Nov 9, 2021 at 21:39
  • @IrvinJayG. yes it is! We only need 5 though. Commented Nov 9, 2021 at 21:39
  • I assume that it matters what the score is if it is zero, correct? In other words, you wouldn't want someone listed who had no matches for anything, correct? Commented Nov 9, 2021 at 22:23

1 Answer 1

3

try simple:

=INDEX(REGEXREPLACE(TRIM(QUERY(SPLIT(SPLIT(FLATTEN(QUERY(QUERY(QUERY(SPLIT(
 FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(QUERY(TRIM(SPLIT(FLATTEN(ROW(A2:A)&"♪♥♂♀"&SPLIT(IFNA(
 VLOOKUP(B2:B, SPLIT(FLATTEN(QUERY(QUERY({"♠"&Freelancers!A2:A&"♀"&Freelancers!B2:B, Freelancers!C2:C&"♣"}, 
 "select max(Col1) group by Col1 pivot Col2"),,9^9)), "♣"), 2, )&
 VLOOKUP(C2:C, SPLIT(FLATTEN(QUERY(QUERY({"♠"&Freelancers!A2:A&"♀"&Freelancers!B2:B, Freelancers!D2:D&"♣"}, 
 "select max(Col1) group by Col1 pivot Col2"),,9^9)), "♣"), 2, )&
 VLOOKUP(D2:D, SPLIT(FLATTEN(QUERY(QUERY(IFERROR(SPLIT(FLATTEN(IF(IFERROR(SPLIT(Freelancers!E2:E, ","))="",,
 "♠"&Freelancers!A2:A&"♀"&Freelancers!B2:B&"♦"&SPLIT(Freelancers!E2:E, ",")&"♣")), "♦")), 
 "select max(Col1) group by Col1 pivot Col2"),,9^9)), "♣"), 2, )), "♠")), "♥")), 
 "select Col1,(count(Col2)-100)*-1,Col2 group by Col1,Col2 order by Col1,(count(Col2)-100)*-1 desc"), 
 "where Col3 <> '♂♀'"), "offset 1", )),,9^9)), "♪"), "select max(Col2) group by Col2 pivot Col1"), 
 "offset 1", ),,9^9)), "♫"), "♀"), "select "&JOIN(",", "Col"&SEQUENCE(10)+1))), " \d+ ♂$", ))

enter image description here

demo spreadsheet

Sign up to request clarification or add additional context in comments.

1 Comment

Ok dude, I see you. This is absolutely crazy. I have no idea what's going on. But it works. Thank you so much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.