+ Reply to Thread
Results 1 to 3 of 3

How to program my macro to choose between multiple modes and no modes

  1. #1
    Registered User
    Join Date
    11-27-2017
    Location
    Arkansas
    MS-Off Ver
    Windows 10
    Posts
    2

    How to program my macro to choose between multiple modes and no modes

    First, I really am a novice in excel and I'm not even sure that I'm even asking the right question.

    Background: We have created a macro that takes 30,000 or so rows and organizes it so that the mode of each variable (in this case the variable is a combination of Operator Name and Operation) appears at the top of the range. We then use vlookup to analyze the mode of each Operator Name+Operation in a separate template.
    There are three problems:
    1. Sometimes there are multiple modes. Currently the program randomly choose which mode to appear on the top. However, I would like to choose the lowest value mode to appear at the top.
    2. The second problem is that if there is no mode the program currently chooses a random number to appear on top. I would like it to leave the top cell blank instead or to return an N/A so that I will no that there is no mode.
    3. The third problem is that the mode is not valuable for analysis unless it repeats more than 7 times. Currently even if it repeats 2 times it still returns that number at the top. Instead, I would like the macro to leave the cell on top blank or return a N/A.

    Thank you for your help!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to program my macro to choose between multiple modes and no modes

    Hi and welcome to the forum

    Please upload a workbook or a representative cut down copy, (we don't need all 30k rows) and anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-27-2017
    Location
    Arkansas
    MS-Off Ver
    Windows 10
    Posts
    2

    Re: How to program my macro to choose between multiple modes and no modes

    Thank you for your help.
    Here is the link to the Template: https://drive.google.com/open?id=1Nx...CzO5dbaUqR3QRX
    The data in the template is after the macro, called "mode", has run.
    When the macro is run, the result of the macro is Column P, Q, R, and Solumn S. The mode for this data appears at the top of each group in the following locations:
    S2
    S553
    S1120
    S1163
    S2207
    S2522
    S2699
    S2925
    S2948
    S3214
    S3573
    S4102
    S4380
    S4882
    S5390
    S5936
    S6502
    S6518
    S7068
    S7328
    S7859
    S8429
    S8954
    S9487
    S10036
    S10037
    S10553
    S10560
    S10600
    S10605
    S10623
    S10909

    Sheet 2 of the template is where I manually found the mode for each group. You can see in the third column that several times there was no mode and the macro chose a random number to put at the top. There are also several cases where the mode repeated less than 7 times and in this case I would like the macro to leave the cell blank on top.

    Is this enough information to explain my situation?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding Multiple Text String Modes from a single range
    By liquidmettle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-16-2015, 02:28 PM
  2. debug modes learning
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-18-2013, 04:51 AM
  3. Excel 2010: Mode.Sngl not returning lowest of multiple modes
    By yukontornado in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2013, 04:26 PM
  4. Excel 2007 : Excel 2007 Save Modes
    By ravichander in forum Excel General
    Replies: 4
    Last Post: 07-11-2008, 01:21 PM
  5. [SOLVED] switching between modes
    By Joe in forum Excel General
    Replies: 3
    Last Post: 02-09-2006, 10:00 AM
  6. switching between modes
    By Joe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 12:00 PM
  7. Design/run modes for a button
    By Mike Reedich in forum Excel General
    Replies: 1
    Last Post: 04-02-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1