This little google apps script will make it happen:
function LASTCON(array) {
// set active spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// get active sheet
var sh = ss.getActiveSheet();
// get data
var data = sh.getRange(array).getValues();
// determine length of array
var dLen = data.length;
// create yes counter
var yesCount = 0;
// itterate through array (backwards)
for(var i=dLen-1; i>=0; i--) {
if(data[i] == "Y") {
yesCount++;
} else {
break;
}
}
// pass result to formula
return yesCount;
}
Add this script, via the script editor, to your spreadsheet and the function LASTCON is available throughout the worksheet, like so: =LASTCON("A1:A6")
See example file I've prepared: Last consecutive values in a column (editable)