Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

google sheets - How to return last ocurrence of a name in column A if the content in column B is not empty

I'm trying so hard to develop a function that returns the last ocurrence of a name in column A if the content in column B is not empty. I illustrated the behavior of this in the image bellow:

enter image description here

The formula should:

  • Ignore empty spaces in column A
  • No need for changes if rows are added

I couldn't go further than that:

=INDEX(A3:B,SMALL(IF(A3:A=D2,ROW(A3:A)-ROW(A3)+1,ROW(INDIRECT("A"&COUNTA($A:$A)))+1),COUNTIF(A3:A,D2)),2)

Any help?

Thanks

Link to the sheet (GOOGLE SHEETS) in image: https://docs.google.com/spreadsheets/d/1tYmq4H4i9Y3LJnOOkT8XArNzEWnkhpEk1yDiBjvctRI/edit?usp=sharing


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

use:

=ARRAY_CONSTRAIN(SORTN(QUERY(SORT({A3:B ROW(A3:A)}; 3; 0); 
 "where Col2 is not null"; 0); 9^9; 2; 1; 1); 9^9; 2)

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...