+ Reply to Thread
Results 1 to 15 of 15

Problems using the MODE function

  1. #1
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Problems using the MODE function

    Hi guys,

    Don't know if anyone can help with this, I think it's pretty simple, but can't find an example on Google that's similar enough!

    I am looking to find the modal value when certain conditions apply.

    I am using two sheets and wish to find the mode of a given production line (out of 3 possible 'lines', B, C & D). I have a list of 'products made' (Column A, Sheet 1), the 'runs' of these products (Column A, Sheet 2), where each product has multiple runs. Finally, the 'line' on which the product was ran (Column C, Sheet 2).

    I wish to find the modal line on Sheet 1 for every product, based on the previous runs.

    I've tried MODE, MATCH, IF & INDEX statements in a few different ways and think I may be over-complicating things!

    Any help/advice would be appreciated, thanks!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    Welcome to the forum!

    Will you please attach a sample Excel workbook? We won't be able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Re: Problems using the MODE function

    Okay, so my data set is something like:

    SHEET1:

    CODE(A) DESCRIPTION(B) LINE(C)
    AAA *** A
    AAA *** A
    AAA *** A
    AAA *** B
    AAB *** A
    AAB *** B
    AAB *** B
    AAB *** B
    AAC *** B
    AAC *** C
    AAC *** C
    AAD *** B

    etc


    SHEET2:

    CODE(A) DESCRIPTION(B) MODAL LINE(C)
    AAA *** ?
    AAB *** ?
    AAC *** ?

    So, on Sheet 2, I wish the CODE in Sheet 1 to be looked up, and if there is a match, for the mode then to be calculated.
    I'm working with roughly 1000 codes and Data that constantly updates, with about 3000 runs of every product. Not sure if this is clear, but any help would be great.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    No, not a lot of help, sorry - see the instructions in post #2.

  5. #5
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Re: Problems using the MODE function

    I've tried to attach an example Workbook, not sure if it's worked.

    Doesn't really show any more than my post does
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    No, and that's because you haven't read the instructions I gave you, specifically:

    2. Make sure that your desired solution is also shown (mock up the results manually).
    A series of question marks does not help us much.

    Please help us to help you by providing all the details requested.

  7. #7
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Re: Problems using the MODE function

    The question marks are where I would like my desired result (modal production line) to be returned. Sheet 2 contains more info

  8. #8
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Re: Problems using the MODE function

    So, for example, the production lines (shown in Sheet 2, B/C/D) will have a modal line, AAB's is D in Sheet 2

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    I'm going to try this one more time.

    What are your expected outcomes in this table?

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    1
    TLA Description Modal Line
    2
    SBF Petproject Grain Free Cat Chicken ^^ ?
    3
    KAU Green Dog Duck Turkey & Veg Adult Dog ^^ ?
    4
    WSE Wafcol Salmon & Potato Adult Senior ^^ ?
    5
    HFE HF24 Venison & Sweet Potato Dog WBDF ?
    6
    SGF Grain Free Small Breed Chicken SwtPot & Herbs ^^ ?
    7
    SBJ Petproject Grain Free Cat Chicken With Turkey ^^ ?
    8
    CLD Power of Nature: Active Dog-Country Lamb Dog ?
    9
    HGC HF24 Wild Boar Adult - Wild Boar with Potato ^^ ?
    10
    CGF Power of Nature: Low Carb Natural Cat-Fees Favourite ?
    11
    HFK HF24 Duck & Potato Adult Dog WBWD ^^ ?
    12
    WCH Wolfit Complete WD Chicken & Brown Rice ?
    13
    SUH Lovejoys Fish & Rice Adult Dog ^^ ?
    14
    FKE Bob & Lush Puppy 60% Duck & Potato ^^ ?
    15
    MXE Millies Wolfheart Working Dog 50% Lamb & Veg ^^ ?
    16
    CFP Natures Way & Wolfit Puppy Chicken With Brown Rice ^^ ?
    Sheet: Sheet1

    Answers, please - the first five rows should be enough to see what you want. I know you know what you want, but we are not mind-readers.

  10. #10
    Registered User
    Join Date
    08-03-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    6

    Re: Problems using the MODE function

    My expected outcome would be the production line that is most frequently used (B/C/D), for every TLA (product), based on all 'runs' of every TLA. (MODAL LINE)

    There are roughly 2000 TLA's and approximately 8000 product 'runs' (that I'm considering), so for every TLA (or product), there are multiple 'runs', sometimes on different 'lines'.

    I'm guessing INDEX, MATCH & MODE will do it?

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    Yes, but WHAT ARE THE ANSWERS that you are expecting in the first five lines? Or don't you know what they should be? Unless we know what we are aiming it, we can't help. It is not our job to manually work out the answer for you - it's your job to tell us the answer you want and then we will try to provide a formula.

    So, please provide the answers you want to see in cells C2 to C6. You don't need to work out the whole dataset - just the first five.

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    1
    TLA Description Modal Line
    2
    SBF Petproject Grain Free Cat Chicken ^^ ANSWER
    3
    KAU Green Dog Duck Turkey & Veg Adult Dog ^^ ANSWER
    4
    WSE Wafcol Salmon & Potato Adult Senior ^^ ANSWER
    5
    HFE HF24 Venison & Sweet Potato Dog WBDF ANSWER
    6
    SGF Grain Free Small Breed Chicken SwtPot & Herbs ^^ ANSWER
    7
    SBJ Petproject Grain Free Cat Chicken With Turkey ^^ ?
    8
    CLD Power of Nature: Active Dog-Country Lamb Dog ?
    9
    HGC HF24 Wild Boar Adult - Wild Boar with Potato ^^ ?
    10
    CGF Power of Nature: Low Carb Natural Cat-Fees Favourite ?
    11
    HFK HF24 Duck & Potato Adult Dog WBWD ^^ ?
    12
    WCH Wolfit Complete WD Chicken & Brown Rice ?
    13
    SUH Lovejoys Fish & Rice Adult Dog ^^ ?
    14
    FKE Bob & Lush Puppy 60% Duck & Potato ^^ ?
    15
    MXE Millies Wolfheart Working Dog 50% Lamb & Veg ^^ ?
    16
    CFP Natures Way & Wolfit Puppy Chicken With Brown Rice ^^ ?
    Sheet: Sheet1
    Last edited by AliGW; 08-04-2017 at 11:25 AM.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Problems using the MODE function

    Try this array formula:
    =INDEX($C$2:$C$86,MODE.SNGL(IF($A$2:$A$86=A2,MATCH($C$2:$C$86,$C$2:$C$86,0))))

    It returns errors if there is only 1 matching value. If you want balnks instead, use:

    =IFERROR(INDEX($C$2:$C$86,MODE.SNGL(IF($A$2:$A$86=A2,MATCH($C$2:$C$86,$C$2:$C$86,0)))),"")

    OR if you want the only value, use this:

    =iIFERROR(INDEX($C$2:$C$86,MODE.SNGL(IF($A$2:$A$86=A2,MATCH($C$2:$C$86,$C$2:$C$86,0)))),A2)

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    I'm glad you understand what is wanted, Glenn!!! punk.gif

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Problems using the MODE function

    We'll see. You seemed to be losing a little of your cool, so I thought I'd jump in wuith a guess...

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,427

    Re: Problems using the MODE function

    Yes, indeed I was. It was a bit like interviewing a politician ...

+ 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. Mode Function
    By wluebbert in forum Excel General
    Replies: 1
    Last Post: 12-18-2014, 06:20 PM
  2. Mode If Function???
    By monkey2003 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-22-2008, 12:36 PM
  3. Mode Function
    By Waffles in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2007, 02:52 PM
  4. The Mode function
    By ampm in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-05-2007, 06:03 PM
  5. Function for top 10 list, Mode function works for first and then?
    By Imiel in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-31-2007, 06:50 AM
  6. mode function help
    By arminius in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 02-20-2007, 04:38 AM
  7. [SOLVED] MODE Function
    By Anita in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-12-2005, 12:30 PM

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