+ Reply to Thread
Results 1 to 3 of 3

Need help with a function to add up shirt orders

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Washington DC
    MS-Off Ver
    Office for Mac 2011
    Posts
    6

    Need help with a function to add up shirt orders

    Hopefully someone can help me with the problem I'm having. I have looked into as many count functions I can think of and dived into array functions and i feel that I am 75% to figuring this out. So to set the table for you this is what I got:

    T-Shirt Size
    Smith L,L
    Jones L
    Cox L,L,L
    Russ XL,L
    L
    XL
    XXL

    So I have figured out the formula to count the "L" in this chart, however the problem I am having is no mater what function or array function I use, when I set it to count the "L" it includes the "L" in XL too and I do not want that. What function can I use where in the cell next to L at the bottom it will count up all the "L" only and reflect 7 Large shirts needed instead of 8 because it reads the L in XL. Does that make sense? thanks for any help.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Need help with a function to add up shirt orders

    Hi and welcome to the forum,

    You can try this formula in C2 and copy it down.

    =LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"XL",""),"L","1"),",",""))

    or if you just need a total use this array formula

    =SUM(LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2:B5,"XL",""),"L","1"),",","")))

    ...confirmed 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. Press F2 on that cell and try again.

    A
    B
    C
    D
    1
    Name Size Count Total
    2
    Smith L,L
    2
    7
    3
    Jones L
    1
    4
    Cox L,L,L
    3
    5
    Russ XL,L
    1
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,513

    Re: Need help with a function to add up shirt orders

    Pl see attached file with UDF CountInCells.
    Attached Files Attached Files

+ 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. Create orders log and monthly report for all orders
    By adfo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2013, 09:39 AM
  2. Shirt sizing and numbering
    By skatedoktor in forum Excel General
    Replies: 5
    Last Post: 10-21-2012, 08:13 AM
  3. [SOLVED] Need help with Pivot Table for t-shirt counts
    By radiorotary in forum Excel General
    Replies: 1
    Last Post: 06-22-2012, 11:38 AM
  4. short-cut ctl& shirt& arrow not working
    By reedzhou in forum Excel General
    Replies: 0
    Last Post: 07-11-2011, 12:41 AM
  5. How do I count shirt sizes and give a total of each?
    By dc112675 in forum Excel General
    Replies: 6
    Last Post: 06-23-2009, 12:41 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