+ Reply to Thread
Results 1 to 16 of 16

Tired of nesting countif functions

  1. #1
    Registered User
    Join Date
    03-08-2017
    Location
    TX
    MS-Off Ver
    2016, 365
    Posts
    4

    Tired of nesting countif functions

    I have a sheet where one column represents the total number of pounds of crawfish that a customer wants. I have another column where the order is broken down into individual bags so if a person orders 80 lbs it shows 30+30+20 in the second column. (Note + could be any symbol to separate amounts. I used it so that in a large order and can stick an = in front to double check that the individual sacks do add up to the total owed.) That all works. Now for the problem. I want to be able to count how many of each size of sack are needed. Right now I have nested countif statements but it is getting harder to keep adding more countif statements as the order gets larger.

    example: Cells F3:F100 have the number of bags needed for individual orders. (Largest sack is 35 lbs.)
    at the bottom of the orders I have a column for the sack sizes and a column for the number of sacks of each size.
    HTML Code: 
    If there a quick way to have it count infinite bags of 30 or 35 lbs without nesting yet another countif?
    Attached Files Attached Files
    Last edited by cajunmiss; 03-09-2017 at 02:12 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Tired of nesting countif functions

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.




    To add a file to a post

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: Tired of nesting countif functions

    deleted.....
    Last edited by protonLeah; 03-08-2017 at 09:02 PM.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    03-08-2017
    Location
    TX
    MS-Off Ver
    2016, 365
    Posts
    4

    Re: Tired of nesting countif functions

    Ben,
    I didn't realized I attached my entire excel file. Please delete your reply...I don't want that whole worksheet to be posted.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: Tired of nesting countif functions

    Quote Originally Posted by cajunmiss View Post
    Ben,
    I didn't realized I attached my entire excel file. Please delete your reply...I don't want that whole worksheet to be posted.
    Looks like your file was removed, can you provide some dummy data, and show what you expect?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    03-08-2017
    Location
    TX
    MS-Off Ver
    2016, 365
    Posts
    4

    Re: Tired of nesting countif functions

    Correct file has been updated.

  7. #7
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,634

    Re: Tired of nesting countif functions

    Why don't you just insert columns with the available bag weights and type numbers under each? I don't understand why you are doing this in the way you are, and particularly with large amounts, having to type 35 again and again does not seem to be a very efficient method of recording this. You seem to be making life very difficult for yourself.
    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.

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: Tired of nesting countif functions

    Breakdown table in I3:O31, using:
    Please Login or Register  to view this content.
    Sack count in B54:B60
    Please Login or Register  to view this content.
    Named Ranges:
    SackBeakdowns: ='Mar 6'!$I$3:$O$31
    SackSizes ='Mar 6'!$I$1:$O$1
    Attached Files Attached Files
    Last edited by protonLeah; 03-09-2017 at 03:27 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,515

    Re: Tired of nesting countif functions

    Attached in Sheet1 has simple calculator for number of bags needed.

    in B3

    =INT(($B$1-SUMPRODUCT(($A2:A$2)*($B2:B$2)))/A3)

    copied down

    weight in B1

    B2 must be blank
    Attached Files Attached Files
    Last edited by JohnTopley; 03-09-2017 at 04:31 PM.

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Tired of nesting countif functions

    Heres my attempt

    counting 5's is buggy so i used what you had previously

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: Tired of nesting countif functions

    @ Ben
    I got an Invalid attachment pop-up so I couldn't check if I've duplicated your efforts. The formulas don't appear to do the same so I'm guessing not.


    I put a lookup table in I3:O14 to get the sack counts.

    The formula is array entered in I3 copied down and across. 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.
    The final formula in B42:B48 is a regular formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Edit forgot to refresh the screen.
    Attached Files Attached Files
    Dave

  12. #12
    Registered User
    Join Date
    03-08-2017
    Location
    TX
    MS-Off Ver
    2016, 365
    Posts
    4

    Re: Tired of nesting countif functions

    Quote Originally Posted by AliGW View Post
    Why don't you just insert columns with the available bag weights and type numbers under each? I don't understand why you are doing this in the way you are, and particularly with large amounts, having to type 35 again and again does not seem to be a very efficient method of recording this. You seem to be making life very difficult for yourself.
    I give the spreadsheet to the people who bag up the crawfish. Putting all those columns confused them. They just wanted a list of bags to make.

  13. #13
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Tired of nesting countif functions

    also FLOOR.PRECISE maybe
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  14. #14
    Registered User
    Join Date
    05-21-2014
    Posts
    92

    Re: Tired of nesting countif functions

    Quote Originally Posted by cajunmiss View Post
    I give the spreadsheet to the people who bag up the crawfish. Putting all those columns confused them. They just wanted a list of bags to make.
    In vlady's "Crawfish 2017 with floor,xlsx", place in one of the empty cells of row 3 the following formula:

    Please Login or Register  to view this content.
    It will give you the text that you want for that row and you can then hide/group the columns out of sight.

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: Tired of nesting countif functions

    Withdrawn by FR. Formula doesn't return correct counts.
    Last edited by FlameRetired; 03-09-2017 at 04:17 PM.

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

    Re: Tired of nesting countif functions

    Another way. Counts the number of sacks in the concatenated strings.

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

+ 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. Nesting Vlookup Functions with IF Functions and possibly more
    By Anitarizzo in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-27-2014, 12:50 AM
  2. Tired of having 259 "IF" functions nested in a single cell
    By Selko in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-14-2014, 11:55 AM
  3. nesting MATCH with COUNTIF functions
    By Rblack40 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2012, 08:37 PM
  4. Nesting COUNTIF and IF functions
    By EagleJTR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-27-2006, 03:58 PM
  5. Nesting functions in the functions dialog box
    By cs170a in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  6. Nesting functions in the functions dialog box
    By cs170a in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. Nesting functions in the functions dialog box
    By cs170a in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  8. Nesting functions in the functions dialog box
    By cs170a in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-10-2005, 06:05 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