@Hammy I would still suggest you try and formulate your problem with a clearly described example illustrating what kind of formula you would need.
If pure computing power is the issue you could try parallelization combined with group loop. It might need some experimenting.