+ Reply to Thread
Results 1 to 28 of 28

Count and list values in a column if certain conditions are met

  1. #1
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Count and list values in a column if certain conditions are met

    Hello,

    My apologies if this is the wrong place to post but I am trying to find out if and how I can extract more data than just by using countifs.

    I have just learned countifs and I think it?s great. I want to make lists based on several colums and I can?t make it work with the formulas I know of as of know.

    For example, if A is sales rep, B is name of customer and C is order status, is there a way to count AND present the name of each unique value in list form?

    I want to not only count the sales of a rep but also list the name of the businesses he has sold to. For example I only want to show pending sales from sales Rep 1, and list the name of all customers that has a pending sale sold by Sales rep 1. I know how to count this but I also need a list that displays the name of each customer, not just the number of sales of a given type or by a given rep. Another example is to show all orders from Sales rep 1 in June and list the value of each sale in that category in a list. Hope this makes sense.

    I have tried using AI but it?s not really working. I can do what I want today combining SUM, COUNTIFS and manual typing but I want to fully automate it.

    Appreciate any suggestions.

    Edit: My bad, I have attached a very easy example. Had to make it now so just made it super simple to illustrate what I want.
    Attached Files Attached Files
    Last edited by john.g.1; 07-05-2023 at 07:56 AM.

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

    Re: Count and list values in a column if certain conditions are met

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Thank you :D

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

    Re: Count and list values in a column if certain conditions are met

    Where's the attachment?

  5. #5
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Edited my opening post now.

  6. #6
    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,059

    Re: Count and list values in a column if certain conditions are met

    LoL. It's too simple.

    WHAT do you expect to see as the end result?

    WHERE is the data coming from?
    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

  7. #7
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    OK I am sorry Glenn, just made it on the spot.

    The data is a massive exported Excel-list from a CRM system with hundreds of lines of sales from a number of sales reps, of various value and to a number of unique customers.

    My goal was simply to show what I wanted to create in the end.

    IF sales rep = "x", AND sales status = "sold", I want to show that in a list (not using countifs, but displaying each company that has a sold order from sales rep x).

    My issue is that I can count the number of "sold" from rep "x", but not display them in a list. Today I have to manually name each company in various lists.

    I want to be able to say "list the name of every company that has a lost order in which sales rep 1 was the seller".

    For example: B15 in sheet "Andy" says "Apple" because I manually entered it. I want that cell to be filled in automatically.
    Last edited by john.g.1; 07-05-2023 at 05:31 AM.

  8. #8
    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,059

    Re: Count and list values in a column if certain conditions are met

    Please upload a morecrealistoc sample, clearly showing what you expect to see and where you expect to see it.

  9. #9
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    OK, should I manually enter what I want to see then?

  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,916

    Re: Count and list values in a column if certain conditions are met

    YES! We are good, but we are not clairyoyant.

  11. #11
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    OK I have updated it. The problem is I cannot use any real data so I have to make stuff up which takes a long time.

    So page 1 will be imported directly from a CRM system.

    I want the AB sheet (here I have one sheet for each sales rep) to be updated automatically, not manually as I have in this example. If I can do that, I can just replace the info on sheet 1 with updated additional info as the year progresses.

  12. #12
    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,916

    Re: Count and list values in a column if certain conditions are met

    The problem is I cannot use any real data so I have to make stuff up which takes a long time.
    So does anyone sharing data here. I shall take another look.

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

    Re: Count and list values in a column if certain conditions are met

    OK - had a look.

    What is source data and what is what you are trying to achieve? Some signposting would help, please.

  14. #14
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Source is an exported Excel-file from an external CRM system. I just paste that and replace existing data in sheet 1 from time to time to get the updated results.

    On the "AB" sheet, I want to format it so that IF sales rep = AB, AND a sale was processed between 01.01-31.01, the name of the company the order was sold to should be placed in B4. Naturally, there would be say 20 sales for the month so B4-B24 should all be company names.

    Sort of a COUNTIFS (I guess) but not just add the total sales from January and give me a number, but rather list each sale, specifically by customer name.

    B16 (or wherever this was to be placed) should be IF sales rep = AB, AND sale = status "sold", the customer name should be listed. In C16, sales rep has to be AB, AND sale status has to be lost. Again, not looking to count the instances, but rather list the name of the sale. Eventually I also want to name the type of good or service that was provided in another list.

    In E15, which has the wrong name I noticed, I want to make a formula so that IF sales rep = AB, AND there has been a sale, regardless of status, the value of the sale should be listed in a row.

    Of course this is easy to do manually at any given point during the year, but I want to paste new data and overwrite existing data in sheet 1 regularly, and the various tables has to be expanded and updated accordingly. I am not sure if Excel alone is enough to do this or if I need to use VBA or Python as well.

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

    Re: Count and list values in a column if certain conditions are met

    OK. Let's start with this drag copied across (remove ALL data first):

    =LET(f,FILTER('Ark1'!$B$6:$B$48,MONTH('Ark1'!$E$6:$E$48)=MONTH(DATEVALUE(B$3&" 1"))),c,COUNTA(f),IFERROR(VSTACK(f,"Total: "&c),""))

    Correction:

    =LET(f,FILTER('Ark1'!$B$6:$B$48,(MONTH('Ark1'!$E$6:$E$48)=MONTH(DATEVALUE(B$3&" 1")))*('Ark1'!$A$6:$A$48=$A$1)),c,COUNTA(f),IFERROR(VSTACK(f,"Total: "&c),""))
    Attached Files Attached Files
    Last edited by AliGW; 07-05-2023 at 08:27 AM.

  16. #16
    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,916

    Re: Count and list values in a column if certain conditions are met

    Then in B16 copied across:

    =LET(f,FILTER('Ark1'!$B$6:$B$48,('Ark1'!$C$6:$C$48=B$15)*('Ark1'!$A$6:$A$48=$A$1)),c,COUNTA(f),IFERROR(VSTACK(f,"Total: "&c),""))

    Really not sure where you are getting the averages from.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    OK - so the first formula goes in B4 and across?

    I have removed the data in sheet 1 - I am now getting #NAME?.

    I tried the other one in B16 but I am getting an error message. I think it might be because I sometimes need to use semicolon instead of comma which is really annoying. Spent forever yesterday with an easy countif and could not for the life of me figure out what was wrong, until I randomly found out that others were having the same issue.

  18. #18
    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,916

    Re: Count and list values in a column if certain conditions are met

    Open the workbook I attached!

  19. #19
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    I have. Looking at it now.

  20. #20
    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,916

    Re: Count and list values in a column if certain conditions are met

    You will find the formulae correct for your locale when you open it.

  21. #21
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Yes the first one seems great!

    When I try to post the formula in B16, I get the error "The first argument of LET must be a valid name".

    What data should I remove? The made up in sheet 1?

  22. #22
    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,916

    Re: Count and list values in a column if certain conditions are met

    It works in the attachment I provided - did you open the correct attachment?

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    B
    C
    D
    15
    Sold Lost Pending
    16
    Walgreens Boots Alliance Intel General Electric
    17
    Total: 1 Pfizer Kroger
    18
    Total: 2 Citigroup
    19
    Total: 3
    Sheet: AB

  23. #23
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Yes - it was not already posted in B15 so I tried doing it. Could it be a language setting issue?

  24. #24
    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,916

    Re: Count and list values in a column if certain conditions are met

    It is language, but as you haven't said what your exact locale is, I cannot provide you with a translation.

    Open the SECOND attachment I provided in post #16.

  25. #25
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Yes I have opened the most recent version.

    My locale is Norway but I changed language to English in Excel now.

    That beautiful table you posted I cannot see at all.
    Last edited by john.g.1; 07-05-2023 at 10:10 AM.

  26. #26
    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,916

    Re: Count and list values in a column if certain conditions are met

    That should not be necessary, in fact it might make things worse.

    =LET(f;FILTRER('Ark1'!$B$6:$B$48;(MÅNED('Ark1'!$E$6:$E$48)=MÅNED(DATOVERDI(B$3&" 1")))*('Ark1'!$A$6:$A$48=$B$1));c;ANTALLA(f);HVISFEIL(VSTACK(f;"Total: "&c);""))

    =LET(f;FILTRER('Ark1'!$B$6:$B$48;('Ark1'!$C$6:$C$48=B$15)*('Ark1'!$A$6:$A$48=$B$1));c;ANTALLA(f);HVISFEIL(VSTACK(f;"Total: "&c);""))

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

    That beautiful table you posted I cannot see at all.
    It is in the attachment to post #16. Attached again here.
    Attached Files Attached Files

  27. #27
    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,916

    Re: Count and list values in a column if certain conditions are met

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  28. #28
    Registered User
    Join Date
    07-05-2023
    Location
    Europe
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    13

    Re: Count and list values in a column if certain conditions are met

    Thank you so much. Been looking at it now and trying to edit it to fit my real data.

    Your skills are very impressive
    Last edited by john.g.1; 07-05-2023 at 03:09 PM.

+ 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. Replies: 2
    Last Post: 11-23-2020, 12:03 PM
  2. [SOLVED] Count unique values from a column with conditions
    By Fullspeeduws in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2018, 08:19 AM
  3. [SOLVED] Count of the top largest values within a list, but with conditions
    By JimDandy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-08-2017, 12:10 PM
  4. Replies: 2
    Last Post: 08-19-2015, 10:22 AM
  5. Replies: 2
    Last Post: 01-21-2014, 02:53 PM
  6. [SOLVED] Count values with conditions
    By bigband1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-16-2014, 11:49 AM
  7. Replies: 1
    Last Post: 01-28-2012, 11:51 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