I can do this manually but I want to automate it since I'll probably have to do it again...

I have a spreadsheet with 4 columns...

A, B, C, D

A is a sequential number

D is an elevation

I need a formula that says if column A is X then Average the values in column D.

It'd be even better if it said if the value in A is equal, then average D. Make it a little more automated, but either will do.

Is this even possible?