As a sequel to this question Formula for matrix (dates in ascending order) how would the formula (=IF($B2="Apple",A2-SORT(FILTER(A:A,B:B="Pear", A:A<$A2),1,FALSE),"") be modified if the dates are in descending order?

That is, Tony ate an apple on some day, how many days before did he eat a pear?

enter image description here

1 Answer 1


3 changes, those in red/bold :


  • Perfect! Thanks. In future, kindly post code, it's easier to copy-paste
    – beeshyams
    May 22 at 11:18
  • 1
    I could not do it, since it is not possible to highlight those 3 parts in red
    – Daniele
    May 22 at 11:21
  • Got it thanks...
    – beeshyams
    May 22 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.