bhorsley89
New Member
- Joined
- Oct 24, 2024
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I'm wanting to return a value that corresponds to another value that is closest to a target value that I determine. For example, in cell H4, I input the number 6 which returns 113 in cell J4. This currently works as 6 is closest to 5 in column B (mins) and the value 113 in column C (var1) is associated with this row index.
The formula I'm using to achieve this is:
=INDEX(C4:C9,MATCH(MIN(ABS(B4:B9-H4)),ABS(B4:B9-H4),0))
However! I'd like to apply the same thought process and formula to find the closest value to a target (cell H4) but based on the value in cell I4 (test type). So, in essence, how can I edit my formula to return a value in column C (var1) that is based on finding the closest value in mins (column B) to that in cell H4, but only for tests (column A) that match cell I4?
Note, I'd like to achieve these two things within the one formula and cell (J4). In addition, like the current formula, if a number I input in cell H4 doesn't exist, I'd still like the next closest to be returned.
The formula I'm using to achieve this is:
=INDEX(C4:C9,MATCH(MIN(ABS(B4:B9-H4)),ABS(B4:B9-H4),0))
However! I'd like to apply the same thought process and formula to find the closest value to a target (cell H4) but based on the value in cell I4 (test type). So, in essence, how can I edit my formula to return a value in column C (var1) that is based on finding the closest value in mins (column B) to that in cell H4, but only for tests (column A) that match cell I4?
Note, I'd like to achieve these two things within the one formula and cell (J4). In addition, like the current formula, if a number I input in cell H4 doesn't exist, I'd still like the next closest to be returned.