Can you show what is its solution for the original sample data? Why that discrepancy for you original sub2() function? [[alternative HTML version deleted]]