Application.WorksheetFunction.Max Against Column Containing Formulas Question:

MattDW

Board Regular
Joined
Mar 7, 2007
Messages
66
MrExcel forum users,

I am using the below VBA formula in an attempt to find the largest value of a cell range J3:J42.

However, the data in the J3:J42 range of cells has been created using a MID formula that feeds from the adjacent column that contains a string of text and numbers(the MID formula results in only the number portion being displayed in cells J3:J42).

I know the Application.WorksheetFunction.Max works when used against a column containing numerals. Is there a way to adjust this line to work correctly against a column containing formulas by reading the value of each cell?

Sub LargestValue()
'Finds Largest Number In The "Netbook Friendly Number - Number Only" Column Of The Netbook Number Worksheets
Dim WS
Call DefineRanges
WS = ActiveSheet.Name
MaxNum = Application.WorksheetFunction.Max(Worksheets(WS).Range(NetbookCartWSSortByCol))
End Sub

Thanks much!

-Matt- :-)
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Can you not coerce the text results of the MID function to numerical? e.g
=MID(A1,1,1)+0
=--MID(A1,1,1)
 
Upvote 0
Can you not coerce the text results of the MID function to numerical? e.g
=MID(A1,1,1)+0
=--MID(A1,1,1)

Interesting idea Njimack,

The formula I used in column J is:

=IF(I3="","",IF(ISERROR(FIND("-",I3)),SUMPRODUCT(MID(0&I3,LARGE(INDEX(ISNUMBER(--MID(I3,ROW($1:$25),1))*
ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10),MID(I3,SEARCH("-",I3)+1,LEN(I3))))

This is because the value in column I contains a combination of straight numerals, a word with a dash followed by a numeral and a letter numeral combination. Any ideas how I might coerce the results of the above formula into a numeral?

Thanks much,

-Matt- :-)
 
Upvote 0
Can anybody tell me if there's a way to convert MaxNum = Application.WorksheetFunction.Max(Worksheets(WS).Range(NetbookCartWSSortByCol)) so that it's evaluating the value of the cell that is returned by the formula, rather than looking at the cell as a non-numeric value and returning a 0?

Thanks much,

-Matt- :-)
 
Upvote 0

Forum statistics

Threads
1,223,262
Messages
6,171,080
Members
452,377
Latest member
bradfordsam

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