Copy value of a cell if it is closest
Closed
Travis
-
Jun 21, 2010 at 07:16 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 21, 2010 at 07:34 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 21, 2010 at 07:34 PM
Hello,
I would like to compare cells A1, B1, C1, D1 with cell F1. I would like to copy the value of the Cell from A1, B1, C1, D1 that is closest to the value of cell F1. Any ideas on how to do this in vba or with some crazy functions. I could do the comparisons manually, but who wants to do that.
Thanks
I would like to compare cells A1, B1, C1, D1 with cell F1. I would like to copy the value of the Cell from A1, B1, C1, D1 that is closest to the value of cell F1. Any ideas on how to do this in vba or with some crazy functions. I could do the comparisons manually, but who wants to do that.
Thanks
Related:
- Copy value of a cell if it is closest
- If cell contains date then return value - Excel Forum
- If cell A1 has text then cell B2 has today's Date ✓ - Excel Forum
- Conditional formatting if cell contains text - Excel Forum
- Count if cell contains number - Excel Forum
- An example of a cell is a blank cell ✓ - Programming Forum
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Jun 21, 2010 at 07:34 PM
Jun 21, 2010 at 07:34 PM
=IF(ABS(F1-A1)<=MIN(ABS(F1-B1),ABS(F1-C1),ABS(F1-D1)), A1,IF(ABS(F1-B1)<=MIN(ABS(F1-A1),ABS(F1-C1),ABS(F1-D1)),B1,IF(ABS(F1-C1)<=MIN(ABS(F1-A1),ABS(F1-B1),ABS(F1-D1)),C1,D1)))