+ Reply to Thread
Results 1 to 18 of 18

I try to generate a list based on a criteria, but ...

  1. #1
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    I try to generate a list based on a criteria, but ...

    I try to generate the list based on a criteria: if the "name" on the first column = "George" (for example), display a list with subjects he/she attended and for how many hours and if he/she attended the same subjects display it only once and sum the hours.
    What is colored in yellow is manually entered, just to show you what I want to accomplish.

    I tried with a combination of IFERROR, INDEX, and SMALL functions but it doesn't work. Any help will be appreciated!
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: I try to generate a list based on a criteria, but ...

    Hello Georgeunlock. Welcome to the forum.

    Try this in F14 and copy down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: I try to generate a list based on a criteria, but ...

    I highly recommend restructuring the data to 4 columns; Name, Hours per day, Subject, and Weekday.

    When data is clean like this, it is much easier to work with, and you can do more with it such as build pivot tables with slicers to give a more professional report.

    Please see attached.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    Thank you! You are right, it is easier to use sumproduct function to sum the hours. The part that I still don't figure out is how to display the list of subjects per each individual (cell E14,15 and so on).

  5. #5
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    It is very clean your method but I have many students and all my data is structured this way. I tried to use pivot tables with slicers but the output is not user friendly because I have to filter 30/31 columns corresponding to each day of the month. Maybe I do something wrong! Thank you!

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

    Re: I try to generate a list based on a criteria, but ...

    Are you using Excel 2016 or have you upgraded to 365?
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    Unfortunately Excel 2016. There are some functions like XLOOKUP which are not available in this version, that I read that are very handy for my table.

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2502 and WPS V2024(12.1.0.18543)
    Posts
    3,861

    Re: I try to generate a list based on a criteria, but ...

    Cell F14 formula , Drag down

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    Thank you. My problem is with cells E14,E15, E16, E17 and so on.... I want them (subjects) to be displayed from the table based on the name of the student. In my sheet they were entered manually and it's time consuming.

  10. #10
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: I try to generate a list based on a criteria, but ...

    Might be a neater way (certainly is in 365) but this works...

    E14, copied down to E18:

    =IFERROR(INDEX(Disciplines,AGGREGATE(15,6,IF(ISNUMBER(MATCH(Disciplines,INDEX($B$3:$K$10,MATCH($D$14,name,0),{2;4;6;8;10}),0)),ROW(Disciplines)-MIN(ROW(Disciplines))+1,""),ROW()-ROW($E$13))),"")

    F14, copied down to F18:

    =IF(H14="","",SUM(IF(IF(name=$D$14,$C$3:$K$10,"")=H14,$B$3:$J$10,0)))

    Edit - note the order is the same as the master list of disciplines, not the order of the days as per the example - not sure if this is important.

  11. #11
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2502 and WPS V2024(12.1.0.18543)
    Posts
    3,861

    Re: I try to generate a list based on a criteria, but ...

    ANS. Post#9

    First delete E14:E17

    Cell E14 array formula , Drag down

    P/S : If the first one doesn't work, use the second method , Because different countries, some countries accept the first method, some countries accept the second method, the difference is only a symbol "!"

    1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by wk9128; 09-16-2022 at 09:51 AM.

  12. #12
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,984

    Re: I try to generate a list based on a criteria, but ...

    I changed the file by deleting the merged cells

    Calculate the total hours per student and subject and the hours per day.




    F14=SUMPRODUCT((ISNUMBER(MATCH($A$3:$K$10,$E14,0)))*(N(+$B$3:$L$10))*(INDEX($A$3:$K$10,,MATCH($D$13,$A$2:$K$2,0))=$D$14))

    Copy down

    H14=SUMPRODUCT((ISNUMBER(MATCH($A$3:$K$10,$E14,0)))*(N(+$B$3:$L$10))*(INDEX($A$3:$K$10,,MATCH($D$13,$A$2:$K$2,0))=$D$14)*($A$1:$K$1=H$13))

    Copy across and down
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    With both formulae I get the message: "This value doesn't match the data validation restriction defined for this cell."

    I try to figure why the error. Thank you!

  14. #14
    Registered User
    Join Date
    09-15-2022
    Location
    texas
    MS-Off Ver
    2016
    Posts
    7

    Re: I try to generate a list based on a criteria, but ...

    Many thanks to the all the users who tried to assist me, especially to CARACALLA for his solution. We all have many things still to learn, me included!

  15. #15
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,984

    Re: I try to generate a list based on a criteria, but ...

    Correct file.
    The previous one had a wrong structure

    G14=SUMPRODUCT((ISNUMBER(MATCH($A$3:$K$10,$F14,0)))*(N(+$B$3:$L$10))*(INDEX($A$3:$K$10,,MATCH($E$13,$A$2:$K$2,0))=$E$14))

    Copy down


    I14=SUMPRODUCT((ISNUMBER(MATCH($A$3:$K$10,$F14,0)))*(N(+$B$3:$L$10))*(INDEX($A$3:$K$10,,MATCH($E$13,$A$2:$K$2,0))=$E$14)*($A$1:$K$1=I$13))

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: I try to generate a list based on a criteria, but ...

    Quote Originally Posted by Georgeunlock View Post
    Thank you! You are right, it is easier to use sumproduct function to sum the hours. The part that I still don't figure out is how to display the list of subjects per each individual (cell E14,15 and so on).
    With Office 2016 you will need to array enter this formula in E14 and copy down.

    If you aren?t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  17. #17
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2502 and WPS V2024(12.1.0.18543)
    Posts
    3,861

    Re: I try to generate a list based on a criteria, but ...

    Quote Originally Posted by Georgeunlock View Post
    With both formulae I get the message: "This value doesn't match the data validation restriction defined for this cell."

    I try to figure why the error. Thank you!

    Just select cell D14, the rest are calculated automatically (Because the formula is already set)
    Attached Files Attached Files

  18. #18
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2502 and WPS V2024(12.1.0.18543)
    Posts
    3,861

    Re: I try to generate a list based on a criteria, but ...

    @Georgeunlock You're Welcome. Glad to help . Thank You for the feedback and rep.

+ 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. Generate a list based of certain criteria from multiple sheets
    By yarmin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2018, 03:36 AM
  2. [SOLVED] Generate list of dates between dates based on criteria - Onsite/Offshore holidays
    By sreeks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2017, 12:37 AM
  3. [SOLVED] Generate a list based on meeting certain criteria.
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 11-01-2015, 01:32 PM
  4. Generate a list based on meeting a criteria
    By nekomi15 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-02-2015, 02:31 PM
  5. Excel 2007 : How to generate a list based on criteria
    By fraggle in forum Excel General
    Replies: 7
    Last Post: 05-20-2015, 04:41 AM
  6. Generate list of names based on multiple criteria
    By mattadler22 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-03-2013, 06:02 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