+ Reply to Thread
Results 1 to 15 of 15

Find out most common with variable agegroup

  1. #1
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Find out most common with variable agegroup

    I want to see most common name in the column R.
    I have a column for birth year and a column for male=2 / female=1

    I want to select for example from age 24 to 37
    and then receive result which is most common in total, subtotal females and subtotal males.
    The total is main target, and the split of female and male is just to see the split.

    I am attaching an xls file.
    Is that possible?
    SEALPINO
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Find out most common with variable agegroup

    Hi

    Yes, this can be done with a Pivot Table.

    Attached is an example using your data.

    Hope this is helpful.

    Cheers
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Find out most common with variable agegroup

    Here is a array entered formula* option:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    To get the most common by gender (female in this case) add another IF function as follows:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    *Array entered formulas are activated by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Formulas are applied in ranges next to the summation tables at the bottom of the spreadsheet.
    Let us know if you have any questions.
    Attached Files Attached Files
    Last edited by JeteMc; 03-18-2017 at 10:34 PM. Reason: Correcting errors in formula and file
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    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
    43,984

    Re: Find out most common with variable agegroup

    Or simply using COUNTIFS. Formulae like this one:

    =IF($AE647="","",COUNTIFS($R$2:$R$637,$AE647,$I$2:$I$637,">="&$AF$644,$I$2:$I$637,"<"&$AF$645))

    See sheet for context. Incidentally, you might find it handier to do all your counting on another sheet, or at the top of an empty column, then you can more readily use whole-column references which can make the formulae easier to set up. It also means that the results dont have to be moved around if/when the data change.
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: Find out most common with variable agegroup

    I like the concept. How to have the ranking from nr one in the top and two as second etc?

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,420

    Re: Find out most common with variable agegroup

    Sealpino - your query is well beyond that of a basic user. I am moving your thread to a more appropriate section.
    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.

  7. #7
    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
    43,984

    Re: Find out most common with variable agegroup

    Who are you "talking" to???

  8. #8
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: Find out most common with variable agegroup

    Oh I did not mention to who, I am sorry for not mentioneing that. I lked the concept made by Glenn Kennedy. As I also sent a reputation.
    According to Ali, the question is moved to another section. Sorry for not knowing where is the limit of the questions to be made.
    But I do appreciate your kind effort. Thank you.
    SEALPINO

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,420

    Re: Find out most common with variable agegroup

    Glenn - who are YOU "talking" to? When threads are out of sequence, it's appropriate to post part of the post to which you are responding. I presume you are talking the the OP and not me, since I addressed the OP directly in post #6?

  10. #10
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,420

    Re: Find out most common with variable agegroup

    Quote Originally Posted by sealpino View Post
    According to Ali, the question is moved to another section. Sorry for not knowing where is the limit of the questions to be made.
    Yes, I moved your thread to the appropriate section - Excel Formulas & Functions. This is probably where most of your future queries should be placed, as they are not very basic Excel questions.

  11. #11
    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
    43,984

    Re: Find out most common with variable agegroup

    to return the names in Rank Order needs this array formula:

    =IFERROR(INDEX($R$2:$R$637,MODE(IF($R$2:$R$637<>"",IF(COUNTIF(AE$646:AE646,$R$2:$R$637)=0,MATCH($R$2:$R$637,$R$2:$R$637,0)+{0,0})))),"")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    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...

    EDIT: incorrect sheet attached originally...
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 03-19-2017 at 07:32 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
    43,984

    Re: Find out most common with variable agegroup

    Quote Originally Posted by AliGW View Post
    Glenn - who are YOU "talking" to? When threads are out of sequence, it's appropriate to post part of the post to which you are responding. I presume you are talking the the OP and not me, since I addressed the OP directly in post #6?
    Yes. I was talking to Sealpino

  13. #13
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: Find out most common with variable agegroup

    It works really fine the way you made it.
    What I see is that the names in the R column are listed in top list regardless the total asked within the age group.
    Could the names follow the column with the results of the total?


    From 1900
    To 2017
    Names Total Female Male
    holly 120 69 51
    grotta 103 103 0
    bravo 74 74 0
    terra 34 34 0
    cargo 25 15 10
    kollo 14 14 0 This line should be the last one in the list?
    delta 17 17 0
    alfa 16 16 0

    Total 403 342 61
    Last edited by sealpino; 03-19-2017 at 02:43 PM. Reason: Clarifying myself

  14. #14
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: Find out most common with variable agegroup

    I am attaching an example of the xls document to show.

    SEalpino
    Attached Files Attached Files

  15. #15
    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
    43,984

    Re: Find out most common with variable agegroup

    Fixed... (I hope). I forgot to add a date between X and Y to the MODE.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 03-20-2017 at 04:54 AM. Reason: Wrong attachment attached first time round

+ 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. [SOLVED] Sort out agegroup and separate it between male and females
    By sealpino in forum Excel General
    Replies: 1
    Last Post: 02-07-2017, 05:42 AM
  2. Match Common Variable Across Sheets and Copy a Variable
    By jfyang13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2015, 11:41 AM
  3. [SOLVED] copy common cells and variable range from multiple worksheets to single master workbook
    By tg7384 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-15-2014, 03:05 PM
  4. Combine two files with one common variable
    By Jomejorada in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2013, 04:24 PM
  5. Sorting Data with a Common Variable
    By braveduck in forum Excel General
    Replies: 4
    Last Post: 11-07-2012, 11:57 AM
  6. Merging 2 files/tables with common variable
    By icecube in forum Excel General
    Replies: 4
    Last Post: 06-29-2012, 07:28 AM
  7. Merging two excel sheet with a common variable
    By cheminsl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-07-2011, 10:20 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