Choosing the best cell

citrusfish

New Member
Joined
Nov 24, 2015
Messages
11
Hi

This post has two requests

I have the data shown below:


ABCDEF
1Target 1Target 2Value of Target 1Value of Target 2Best TargetBest Value
254-0.782.22

<tbody>
</tbody>

I would like to research two possible options as I am not sure which will suit my purpose best:

1. Return in F2 the value of C2 or D2 which is closest to 0 and then copy the corresponding Target depending on whether Value Target 1 or Value Target 2 was the closest. So it would return -0.78 in F2 and 5 in E2.


2. Slightly easier I think. I want to return in F2 the Positive value from C2 or D2 and then copy the corresponding Target depending on whether Value Target 1 or Value Target 2 was the closest. So it would return 2.22 in F2 and 4 in E2.

I hope it is OK to ask two questions in one.

Many thanks for any help you can give.

Citrusfish
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi,

If your real data is as straight forward as your sample:


Book1
ABCDEFG
1Target 1Target 2Value of Target 1Value of Target 2Best TargetBest Value
254-0.782.225-0.78<--Question 1
354-0.782.2242.22<--Question 2
Sheet369
Cell Formulas
RangeFormula
E2=IF(ABS(C2)D2),A2,B2)
E3=IF(ABS(C3)>ABS(D3),A3,B3)
F2=IF(ABS(C2)D2),C2,D2)
F3=IF(ABS(C3)>ABS(D3),C3,D3)
 
Upvote 0
Re: Choosing the best cell [SOLVED}

You're welcome, and in re-reading your Question 2, I've made a mistake in my answer for question 2, we need to take Out the ABS function like follows:


Book1
ABCDEFG
1Target 1Target 2Value of Target 1Value of Target 2Best TargetBest Value
254-0.782.225-0.78<--Question 1
354-2.782.2242.22<--Question 2
Sheet369
Cell Formulas
RangeFormula
E2=IF(ABS(C2)D2),A2,B2)
E3=IF(C3>D3,A3,B3)
F2=IF(ABS(C2)D2),C2,D2)
F3=IF(C3>D3,C3,D3)
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top