How to Calculate the Proportion of Specified Data in a Row

Problem description & analysis

Below is an Excel file book1.xlsx:

..

There are seven numbers in each row, including numbers 1 and 2. We are trying to find the proportion of number 1 in a sequence made up of numbers after the first 1 in each row. Below is the expected result:

..

Solution & explanation

Load add-in ExcelRaq.xll in Excel, and 

Enter the following formula in cell H1: =esproc("=(?.pselect@a(~:1).len()-1)/(?.len()-?.pselect(~:1))",A1:G1). Write similar formulas in other cells to get results.

 

Q & A Collection

https://stackoverflow.com/questions/63771136/nuanced-excel-question-calculating-proportions