Get a row number from function

daverunt

Well-known Member
Joined
Jul 9, 2009
Messages
1,946
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I am using a worksheet function to get the minimum value in a column as below. There may be 1-n rows it is looking at.
Is it possible to find which row that the minimum is found, as I would like to check the value in Column C of the same row?

Code:
    Worksheets("Sheet1").Range("D6").Value = Application.WorksheetFunction.Min(Columns("E"))
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You can use Match:

Code:
Worksheets("Sheet1").Range("D6").Value = Cells(Application.Match(Application.WorksheetFunction.Min(Columns("E")), Columns("E"), 0), "C").Value
 
Upvote 0
Hi Rory

Thanks for the reply.
I don't think that's what I am after looking at it?
I need the row because the value in it is to be checked against another cell.
The values are not related other than being in the same row.
 
Upvote 0
If you want the row number rather than the value in col C for that row try
Code:
Worksheets("Sheet1").Range("D6").Value =Application.Match(Application.WorksheetFunction.Min(Columns("E")), Columns("E"), 0)
 
Upvote 0
Time to eat crow.
This is what happens when you don't try before dismissing. :oops:

My thanks to you Rory for the better answer than I was looking for and to you Fluff for the answer I was looking for.
Both will come in handy.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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