I am trying to return the last set of numbers in a column so that I can average a different set of numbers in a second column. Here's what I mean:

0 | 5 |

0 | 6 |

1 | 5 |

1 | 7 |

1 | 1 |

0 | 5 |

1 | 5 |

1 | 1 |

1 | 9 |

0 | 6 |

<tbody>

</tbody>

I would like to average the values beside the last occurrence of 1 (5,1,9). I think I can probably figure out how to do the averaging easily enough but I'd like to know how to return the 5,1,9 by looking up the last occurrence of the series of 1's. The fact that there are three 1's is arbitrary and for example purposes. The number of 1's (and corresponding values in second column) will vary from case to case.

thanks for any help.