Formula to find the location of a value in a range

woodsy74

New Member
Joined
Jun 29, 2012
Messages
20
Below is a sample of the data set (starting in cell A1) I am working with (the real set has many more rows & columns). I have a formula which will return me the Min value (-2.2) and the Max value (3.0). What I am trying to do is add a formula that will return me the location of where the Min and Max values are located. I would like to return either F6 or NY for the Min value and either E3 or GA for the Max value -- looking to get either the cell location or the column header of where the value is located. It is possible that the Min and Max values will be found in multiple locations. I am only concerned with showing one location (it could be the first or the last it doesn't matter).

Is this something that can be done via a formula? Thanks.

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]CA[/TD]
[TD]TX[/TD]
[TD]FL[/TD]
[TD]GA[/TD]
[TD]NY[/TD]
[TD]NJ[/TD]
[/TR]
[TR]
[TD]Ap[/TD]
[TD]1.2[/TD]
[TD]2.2[/TD]
[TD]0.2[/TD]
[TD]2.7[/TD]
[TD]-0.3[/TD]
[TD]1.2[/TD]
[/TR]
[TR]
[TD]Or[/TD]
[TD]1.5[/TD]
[TD]2.5[/TD]
[TD]0.5[/TD]
[TD]3.0[/TD]
[TD]0[/TD]
[TD]1.5[/TD]
[/TR]
[TR]
[TD]Ba[/TD]
[TD]1.1[/TD]
[TD]2.1[/TD]
[TD]0.1[/TD]
[TD]2.6[/TD]
[TD]-0.4[/TD]
[TD]1.1[/TD]
[/TR]
[TR]
[TD]Pe[/TD]
[TD]0[/TD]
[TD]1.0[/TD]
[TD]-1.0[/TD]
[TD]1.5[/TD]
[TD]-1.5[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Ch[/TD]
[TD]-0.7[/TD]
[TD]0.3[/TD]
[TD]-1.7[/TD]
[TD]0.8[/TD]
[TD]-2.2[/TD]
[TD]-0.7[/TD]
[/TR]
[TR]
[TD]Gr[/TD]
[TD]1.0[/TD]
[TD]2.0[/TD]
[TD]0[/TD]
[TD]2.5[/TD]
[TD]-0.5[/TD]
[TD]1.0[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hey,

For the data given try these two formulas:

Put -2.2 in cell I1 and 3 in cell J1 then:

I2:
Code:
ADDRESS(SUMPRODUCT(($B$2:$G$7=I1)*ROW($B$2:$G$7)),SUMPRODUCT(($B$2:$G$7=I1)*COLUMN($B$2:$G$7)))

Drag that across to J2.

Change the range to the appropriate range for your entire data set and you should be good to go!
 
Last edited:
Upvote 0
How about


Book1
ABCDEFGHIJ
1CATXFLGANYNJ-2.23
2Ap1.22.20.22.7-0.31.2
3Or1.52.50.5301.5NYTX
4Ba1.12.10.12.6-0.41.1
5Pe01-11.5-1.50
6Ch-0.73-1.70.8-2.2-0.7
7Gr1202.5-0.51
Sheet2
Cell Formulas
RangeFormula
I3=INDEX($B$1:$G$1,AGGREGATE(15,6,(COLUMN($B$2:$G$7)-COLUMN($B$2)+1)/($B$2:$G$7=I1),1))
J3=INDEX($B$1:$G$1,AGGREGATE(15,6,(COLUMN($B$2:$G$7)-COLUMN($B$2)+1)/($B$2:$G$7=J1),1))

@tyija1995
Your formula will fail if there are duplicates.
 
Upvote 0
This worked great until I started changing some of the values within my data set. Before I made changes the Min formula correctly returned $F$6. I then went into cell A2 and entered -2.2 and when I did the Min formula incorrectly returned $K$11 (which is outside my data set). The formula was working with other changes but doesn't seem to work if the Min (or Max) value is listed more than once in the data set. Is there a way around this? I don't care which cell location I receive from the formula as long as it matches the value I am looking for.
 
Upvote 0
Sorry, I didn't see Fluff's reply. So far that updated formula seems to be working returning the column header. What does the 15,6 represent? If my full data set is B2:HV42 will this work?
Thanks!
 
Last edited:
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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