Maybe it would be a bit clearer if I wrote it like this:
=XIRR(INDEX(F4:S4,AGGREGATE(15,6,(COLUMN(F4:S4)-COLUMN(F4)+1)/(F4:S4<>0),1)):S4,INDEX(F3:S3,AGGREGATE(15,6,(COLUMN(F4:S4)-COLUMN(F4)+1)/(F4:S4<>0),1)):S3)
In this version I used the actual ranges instead of using 3:3 and 4:4, which are shortcut descriptions of saying "row 3" and "row 4". The original formula used COLUMN(F4:S4) to look at the column numbers of your range, then when it found the smallest column with a non-zero amount, plugged it into the row. The one I just posted uses the offset into the range, COLUMN(F4:S4)-COLUMN(F4)+1. The first way is a bit shorter, but the second may be clearer.
As far as the 15 and 6, they are parameters to the AGGREGATE function. AGGREGATE actually is a collection of several different functions. 15 means LEAST, and 6 means to ignore any error values in the list. I used AGGREGATE instead of LEAST because LEAST won't ignore errors, which I intentionally introduced by dividing by (F4:S4<>0).
Anyway, glad I could help!