You can do a neater version of the function using the "Array -> For each XY element" condition instead of a nested for, but this way is more efficient because it loops backwards on the array and stops as soon as it finds the last element that matches your search.
There's a slight problem with this however: this implementation assumes that rows have higher priority in the ordering of elements than columns. This means that in this array
0 2 4
3 5 2
4 2 1
The 'last' 2 would be the one on (1,2), and so LastYIndexOf(2) would return 2
While if you gave higher priority to columns, the last element would actually be the 2 on (2,1) and so LastYIndexOf(2) would return 1
You have to take this into consideration when filling your array. It's not a big problem though, since general convention is to give rows higher priority anyways.