This should be easy, frequent appeared #

rplim2016

Board Regular
Joined
Jun 28, 2016
Messages
76
Hello Mr. Excel users!

Code:
Function abce(mySheet As String, mySELEC As Range) As StringApplication.Volatile
Dim x As Range
    For Each x In mySELEC
        Debug.Print Sheets(mySheet).Cells.Find(what:=x.Value, MatchCase:=True, LookAt:=xlWhole).Row
    Next x
End Function

-above code is working and giving me each ROW # in immediate window through debug.print
-i know there is a "MODE", but how would i incorporate it in this function?
-i want this function just to give me the most frequent row number, so I can use that as my target in other codes.

result should be an integer row # only.

Code:
1
1
1
2

in above case the most frequent row # appeared is 1, so i want the result to be just # 1.

thank you!
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
i figured it out, but there's another problem

Code:
Dim totals(1 To 60) As Integer

Code:
abce = Application.WorksheetFunction.Mode(Array(totals(1), totals(2), totals(3), totals(4), _
                                        totals(5), totals(6), totals(7), totals(8)))

for above, i'll do totals up to 60, but if the totals has no row #, it gives an answer to 0.

then the most frequent # is 0.

how should i set if the totals is to ignore if zero?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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