Formula to select/output the preferred row based on a values proximity to another value

Posted on

QUESTION :

I’m working with a large building footprint data-set that was joined to Parcel data based on geographic location. This Building Footprint data-set has multiple footprints within the same parcel and therefore has identical Parcel_ID’s.

I am looking to find a formula that selects rows based on an identical Parcel_ID and then outputs the preferred footprint (rows) based on how close it’s “Calculated_Square_Footage” values are to the Listed_Square_Footage value.

So take for example: I have a table with 6 building footprints (6 rows of data). All 6 footprints have the same ID (Parcel_ID) and Listed_Square_Footage value because they all lie within the same parcel. But, all 6 footprints have different Calculated square footage calculations because they are different sizes. I want a formula that highlights, selects, or outputs the row where it’s Calculated_Square_Footage value is closest to the Listed_Square_Footage value: (See table below)

Preferred_Footprint_Table_Example

ANSWER :

If you create a helper column with the following formula (I put mine in column F):

=ABS(D2-C2)

You can then use the following formula to return the footprint:

=INDEX(A2:A7,MATCH(MIN(F2:F7),F2:F7,0))

Leave a Reply

Your email address will not be published. Required fields are marked *