Basic order matching


I am using a simple form to take orders, with the relevant variables being Buy/Sell, and Price. At the moment we are manually matching orders by creating custom views and sorting by price.

As the volume of orders increases, this is becoming far too difficult.

How could I create a formula that would allow for basic order matching?

It would need to see if there are any Buy orders (single select field) that have a price higher than the lowest Sell order.

I’ve been tasked with optimizing the process but I’m having a very tough time with the formulas in general, let alone something this complex.

Thanks in advance!