Problem:
Columns A & B contain Client ID's and their recent payment dates.
We want to add the date of the previous payment from the same client next to each entry.
Solution:
Use the INDEX, MATCH, MIN, and IF functions in the following Array formula:
{=INDEX($B$2:$B$10,MATCH(MIN(IF(((B2-$B$2:$B$10)>0)*(A2=$A$2:$A$10),(B2-$B$2:$B$10))),B2-$B$2:$B$10,0))}
Enter the formula in cell C2, and drag down the column.
If a previous payment date does not exist for a particular client, the date of the current pay date will be displayed in both columns.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
Would request you to provide short data also so that everyone can understand easily.