+ Reply to Thread
Results 1 to 21 of 21

Count values in cells that fall between a range, with dash delimiter separator

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Count values in cells that fall between a range, with dash delimiter separator

    Hello,

    I am looking for a way to count how many values fall between a range, where the values in a cell(s) are separated by a dash. I have been looking everywhere but haven't been able to find a solution.

    I have to process very large amounts of data so a function to carry out this task would save me a lot of time though I would be grateful with any solution.

    Thank you
    Attached Files Attached Files
    Last edited by sans; 04-07-2013 at 06:00 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi,

    Maybe someone will come up with a more complex array formula, but if you want a pragmatic solution with helper columns, try the attached.
    I first copied C6 to G6 and then used Text to Columns with the "-" as a delimiter, and then did the same with D6 to L6

    Then used the formula in E6
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count values in cells that fall between a range, with dash delimiter separator

    HI Sans,

    Use below formula which need to be entered with key combination: ctrl shift enter :-
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Count values separated by delimiter.xlsx

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  4. #4
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi Richard and dilipandey,

    Thank you both very much for the replies! I tried both solutions and they both work equally well. One little problem, I will be mainly analyzing large and varying amounts of data where cells contain values separated by a delimiter. I am attaching another example where you can see what I mean. The actual data span down to 3000 rows (in many workbooks). Is it possible in this case to convert your solutions into a udf solution to achieve the same result?

    Thanks again!
    Attached Files Attached Files

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Okay.. so here you would be comparing row 6 results and row 7 results to check if those two are falling in between E1:E2 .. correct?

    If yes, what should be the answer (just for cross checking the formula results) ? Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Count values in cells that fall between a range, with dash delimiter separator

    maybe so
    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Count values in cells that fall between a range, with dash delimiter separator

    UDF

    In cell
    =CountBetween(C6:L11,"-",">="&E1,"<="&E2)

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi guys,

    Thank you very much for the replies, that's exactly the results I was looking for to achieve! Both udf's work fantastic!

    nilem, out of curiosity, how does the function still give the correct result for row 12 in Example sheet 2, where the values are separated with a * ?

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Count values in cells that fall between a range, with dash delimiter separator

    dash "-" is the default delimiter, but if you use a different delimiter (for example, the tilde "~"), you can specify it explicitly in the formula, such as this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi nilem,

    That's super convenient. Having this option there's certainly no need for different udf variations.

    Thank you very much for the great udf. Much appreciated!

  11. #11
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hello,

    I was wondering if it would be possible to request an additional minor version based on any of the above solutions.

    Is it possible to receive as a result the max count found from any one of the cells in a range?

    Thank you very much for all the help.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi jindon,

    That was fast! Thank you very much, I didn't expect to receive such a quick response.

    Works absolutely great. Again thank you for the help!

  14. #14
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hello jindon,

    Your last macro works great, just have a question regarding the time it takes to calculate. I am currently calculating 130 cells in each row, (i.e. A4:DZ4) and going down around 2000 rows. It takes a little over than 20 minutes to calculate the one sheet (I'll be running the same calculation on 130 sheets every few days). Simply wanted to double check if the time it takes to finish the calculation is to be expected.

    Thank you for the help.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Not tested but try change to
    =CountBetween(A4:DZ4,"-",$E$1,$E$2)
    Please Login or Register  to view this content.
    See if any difference.

  16. #16
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hi jindon,

    Thank you for the reply! The calculation dropped quite dramatically, approximately 3 minutes to calculate the whole sheet. Thank you for that.

    I have in total 130 workbooks and each workbook has the one sheet. Is it possible to minimize the calculation time even more?

    Thank you for getting back to me.

  17. #17
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Hello,

    Sorry to be resurrecting the thread again, I encountered today another small hurdle and was wondering if it would be possible to request one last variation based on the original macros you've helped me with, in post #6 and #7. Is it possible to receive the result of only the odd values that fall between a range? I don't know if this requires a new thread, if it does please let me know.

    Thank you for all the help, really appreciated.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-10-2013
    Location
    Saudia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Count values in cells that fall between a range, with dash delimiter separator

    guys help required i want to know that how to calculate the count of different values i.e count the values in between 200 to 300.

    regards.

  19. #19
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Count values in cells that fall between a range, with dash delimiter separator

    deevan,

    You can use
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    04-10-2013
    Location
    Saudia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Help required as sheet is attached.

    Number of count of total customer item (column A)
    number of count of transaction who purchased in between 200 to 300, 301 to 400, and so on different amount.
    Number of count of transaction where we sold item below cost as profit is already in`column E.
    Number of count of profit percentage i. e 60 %, 30% etc.




    Dear San,
    Thanks for you response.
    I want to count the below mentioned data in condition that total number of count where customer purchased more than 200, 300 400, 500, 600(different range) and also compare profit whether it is below cost or not. . I will appreciate if you can help as my data sheet is more than 80k records.

    Sale Amount Cost Profit GM
    202.6 145.586 57.014 3.553513172
    354.57 220.3262 134.2438 2.641239297
    318.84 241.4118 77.4282 4.117879532
    238.65 166.3699 72.2801 3.301738653
    Attached Files Attached Files
    Last edited by deevan; 04-12-2013 at 04:37 PM.

  21. #21
    Registered User
    Join Date
    04-10-2013
    Location
    Saudia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Count values in cells that fall between a range, with dash delimiter separator

    Dear Friends,

    urgent help required.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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