SUM values non contiguous cells IF date for the corresponding value is < or > start date

Job ID: 31962412

Budget: $50 – $100 AUD

C4 needs to show the result: IF(E4>H4&orJ4&orL4,(F4/(D4 [+quantities in I4 & K4 where dates in H4 & J4 are less than E4][-quantity in M when date in L4 is less than E4] *G4))

It becomes more complex in the second quarter as the formula will need to also calculate any quantities where the dates on row 4 are greater then the date in E4,
along with calculation for row 5 same as row 4

I have tried numerous formulas, and have come to the realisation that I need represent dates in the formula,
I have found a lot of information to do this referencing a range, but can't find anything using non contiguous cells.

Any assistance would be greatly appreciated.

Cheers,
Dave.
Related categories: Excel Spreadsheets