Excel VBA Large and Small Functions

Melpp

New Member
Joined
May 3, 2011
Messages
29
I was wondering if there was any way for the Large and Small functions to also return the row number in which it found the largest and smallest values?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Not by itself..

You would use Max/Min in combination with MATCH to find the row number..

In a cell formula, it would be like this

=MATCH(MAX(A:A),A:A,0)


Important to note, that match technically is not returning the row #.
It's returning the position # within the array A:A.
When the array is A:A, or at least begins in row 1 like A1:A10, then yes it happens to be the same as the row #.
But if the array is say A15:A30, and the Max value is in say A20, then the Match returns 6 (A20 is the 6th position in A15:A30)

Hope that helps.
 
Upvote 0
I am using the following but I am getting an error. Anyone know how to fix this?

start_row_mod = WorksheetFunction.Match(Start, Range(Cells(Z, 5), Cells(j, 5)), 1)
 
Upvote 0
I also tried the following with no luck:

start_row_mod = WorksheetFunction.Match(start_row, Range("E" & Z & ":E" & j), 1)
 
Upvote 0
What error do you get?

And can you post all the relevant code?
The code that assignes values to each variable (Start, Z and j)
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

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