Average the closets two out of three number

Occasional Visitor

I have the three numbers in a single row (column B, C, &D). I need a formula that will pick the two numbers out of those three and average them. 

Example:

The formula looks ate column B row 1, column C row 1, & column D row 1. It will determine that column B and Column C have the two numbers out of the three that are closets to each other and average them (Column B and Column C). It will do the same for row 2 and determine that column B and Column D are the closets

BCDE
310930882500 
280827652850 
1 Reply

@barryg1960 

In E1:

=IF(ABS(B1-C1)<=MIN(ABS(C1-D1),ABS(D1-B1)),AVERAGE(B1,C1),IF(ABS(C1-D1)<=MIN(ABS(D1-B1),ABS(B1-C1)),AVERAGE(C1,D1),AVERAGE(D1,B1)))

Fill down.