+ Reply to Thread
Results 1 to 9 of 9

xth of a total of cells

  1. #1
    Registered User
    Join Date
    06-04-2018
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    54

    xth of a total of cells

    Dear specialists
    With the code below I count how many times a certain text (function.caption) occurs in sheet SV-SE, range (D2:D100)

    Please Login or Register  to view this content.
    Now I want to add a piece that shows how much of a total this is. Is that possible?

    example: 2 of 3

    thanks in advance
    Last edited by Samet1805; 06-25-2021 at 11:44 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,863

    Re: xth of a total of cells

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    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
    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: xth of a total of cells

    Maybe something like

    Please Login or Register  to view this content.
    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.

  4. #4
    Registered User
    Join Date
    06-04-2018
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    54

    Re: xth of a total of cells

    Dear Richard

    Thanks for this but I think I was not clear enough.
    Attached you'll find a workbook as an example.

    If doubleclick on "Test 1 or Test 2" a userform will be shown.
    With the spinbutton I can toggle between the cells with the text in the active cell.

    I want in label 2 the total count of the text in the active cell AND the place of the selected cell with this spinbutton.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-04-2018
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    54

    Re: xth of a total of cells

    Hello Everyone

    Is there a solution for my question?

  6. #6
    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: xth of a total of cells

    Sorry it's still not clear.

    There's no userform with spin button shown.

    Please offer some specific examples of what you want to see for various selections/permutations.

    ARe you certain you even need a Userform to do this? It seems you're wanting to count stuff which is more easily done with an Excel function.

  7. #7
    Registered User
    Join Date
    06-04-2018
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    54

    Re: xth of a total of cells

    Dear Richard

    You have to doubleclick on C2, C3, c4, C5, C6 or c7, then the userform is shown.

    for example, if I doubleclick on "test 1" in cell C2, the userform is shown with the label left "test 1" (= the text in C2).
    With the spinnbutton, I can can go to the next or previous cell with the same text. In this example C2 to C4.

    In the label on the right site, I want to show the total of the cells with this text AND show the numeric place of the cell.
    F.e. start is cell C2, so the label must be "1 of 3". If I go to cell C3 with the spinnbutton, the label must be "2 of 3",....

    I do more actions with the userform, but fot my question on the forum, I've simplified it a little bit.
    Attached Files Attached Files

  8. #8
    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: xth of a total of cells

    See attached for one way. Another way would be to hold helper cells on the worksheet that evaluate the item number and position with COUNTIF() functions and read the helper cells into the Label

    In the production model you'll probably want to use a dynamic range name to evaluate the number of items and use the range name in the VBA
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-04-2018
    Location
    Belgium
    MS-Off Ver
    Office 2013
    Posts
    54

    Re: xth of a total of cells

    Thx Richard!

+ 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: 10-30-2020, 05:54 PM
  2. Count cells in a dynamic range, calculate their percentage in respect to total cells.
    By DimitriosNikolouzos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2019, 11:36 AM
  3. Replies: 4
    Last Post: 01-20-2018, 11:14 AM
  4. [SOLVED] Macro to Total a Column Up 15 cells and place total in cell of last row
    By guitarsweety in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-20-2014, 05:25 PM
  5. Replies: 1
    Last Post: 12-18-2012, 01:59 AM
  6. Finding cells that total a specific total
    By odditie in forum Excel General
    Replies: 5
    Last Post: 06-15-2010, 03:08 PM
  7. [SOLVED] Grand total time between two total cells
    By Gwynn in forum Excel General
    Replies: 5
    Last Post: 05-09-2006, 04:10 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