+ Reply to Thread
Results 1 to 13 of 13

How to count the no. of times a specific value is selected in a cell

  1. #1
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    How to count the no. of times a specific value is selected in a cell

    Hi all,

    In the attached excel file, i have the below requirement:

    Column D of sheet "DM PR Availability" contains a dropdown for selecting Do Not Disturb. Whenever a person selects Do Not Disturb, i want the no. of count to be displayed in the DM Dashboard sheet (accessible through Dashboard sheet) under column M for that respective ID. Please note that the count should be displayed only when Do Not Disturb is selected and not when that cell is deleted.

    Note: Sheets : "DM Records", "DM PR Availability" and "Dashboard" will be in Protected Sheet and Protected Workbook state.

    Can anyone help with my requirement. Many thanks in advance.
    Attached Files Attached Files

  2. #2
    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,929

    Re: How to count the no. of times a specific value is selected in a cell

    As you probably know, thuis will require VBA (not formulas), so I will move your thread to that forum.
    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

  3. #3
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: How to count the no. of times a specific value is selected in a cell

    Lines have been added to the worksheet_change code on the "DM PR Availability" sheet code highlighted in red below. Let us know if this works for you.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    Hi maniacb,

    Thank you so much for the solution. Its working perfectly.

    However, i had one more requirement.

    In the attached file, whenever, the cell in D column of DM PR Availability sheet is set to "Do Not Disturb", i want its time stamp (dd-mmm-yyyy hh:mm AM/PM) to be captured in the DND Timestamps sheet against the respective ID.

    All the timestamps should be recorded one below another against the respective IDs.

    Could you please see if its possible. Many thanks in advance.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: How to count the no. of times a specific value is selected in a cell

    I was able to accomplish your requirement only by reverting the table in DND Timestamps back to a regular range and moving the count total above the timestamp columns. See if that works for you.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    All perfect maniacb. Thank you once again.

    However, i required two blank rows (Row 2 and 3) in DND Timestamps sheet. Now, one of the row has been occupied with the count total.

    I tried inserting a blank row, but that seems to have disturbed the VBA.

    Any alternative through which i can insert a row above count?

  7. #7
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: How to count the no. of times a specific value is selected in a cell

    Update the following line of code as follows:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    Thanks a ton maniacb. You really saved my day.

  9. #9
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    Hi maniacb,

    Just a minor query.

    In case i lock the "DND Timestamps" sheet, then the VBA displays an error while capturing the timestamp.

    Any solution so that the timestamps should be captured even if the "DND Timestamps" sheet is locked.

    Thanks again in advance.

  10. #10
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: How to count the no. of times a specific value is selected in a cell

    You can use Protect and unprotect lines with the appropriate password like below.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    Thank you maniacb.

    1 more query - I am sure you might be able to resolve it.

    If you see the sheet "DM Records", it is protected with password 123. However few cells are unlocked i.e. C3:C32

    Now even though the cells are unlocked but when i try to enter data in these cells, excel asks for a password. where in fact it shouldn't ask because the cells are unlocked.

    Can you help with this issue. Thanks in advance.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: How to count the no. of times a specific value is selected in a cell

    You need to unprotect a range in the protected sheet. I made the changes but here are the instructions. https://support.microsoft.com/en-us/...3-042a5f2cd93a
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    769

    Re: How to count the no. of times a specific value is selected in a cell

    Hi maniacb,

    Thank you for your response.

    I tried the method provided in the link to unlock ranges but couldn't succeed.

    Also in the file you shared, when i try entering anything in column C, excel displays a password popup.

    It only works fine if the sheet is protected without a password. Here i entered 123 as password and the pop up is displayed even when entering data in unlocked range..

    Is there anything to be changed in VBA as you prescribed earlier

    dnd.Unprotect Password:="Password"
    dnd.Protect Password:="Password"

    Thanks again.
    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. Count how many times a specific name is selected by month?
    By matt1colorado in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 10-29-2015, 02:20 PM
  2. Replies: 3
    Last Post: 08-07-2013, 04:42 AM
  3. [SOLVED] Count number of times a specific colour is displayed in the cell
    By vignesh805 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2013, 04:45 AM
  4. Macro to take selected cells times a selected cell
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2005, 08:05 PM
  5. Count number of times a specific number is displayed in a cell ran
    By N Harkawat in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 12:05 PM
  6. Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. [SOLVED] Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM

Tags for this Thread

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