+ Reply to Thread
Results 1 to 3 of 3

Command Button for Identifying '1'

  1. #1
    Registered User
    Join Date
    12-02-2016
    Location
    New York
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Command Button for Identifying '1'

    Hi!

    I have a large data set that is compiled within a table in excel (Table 1). Column B has names and all subsequent columns have headers concerning broken bones. If the person has a broken bone in column BS, there is a '1' in the row corresponding with their name. If they do not have a broken bone in Column BS, there is a '0' in the row corresponding with their name. There are 12 columns describing these fractures. I am trying to create a macro to easily locate all the '1's in the table out of 400 individuals. The issue being that when I try to filter the table by '1' in column BS it takes out all the '0's...but then when I want to filter by '1' in column BT, the data is limited to all those individuals who had a broken bone in BS and does not take into account individuals who did not have a broken bone in BS, but who had broken bones in BT. You can see where my issue is here because the data keeps becoming more and more limited as I continue to filter the columns. Is anyone able to help with this coding issue?

    Coding for '0' seems to be much easier and I was able to make a simple code for that (below), but am having issues with coding for '1'.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Command Button for Identifying '1'

    You'd probably want to use advanced filter. Filtering in place.

    See link for tutorial. Criteria range can be set up in another sheet.
    https://www.thespreadsheetguru.com/b...pecific-values

  3. #3
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Command Button for Identifying '1'

    Hi,
    I would suggest to make a trick with our data before filters are applied.
    You could make additional column (probably it can be the last column, after all your data).
    Then write a formula in cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where C2:F2 is range with 1 or 0 and 1 - is criteria for counting.
    Copy this formula down and you will get one, common criteria to filter out all data with 1 or 0.
    As little bonus - you will able to filter out persons, who have more than one broken bone, because formula will count how much '1' there are in one row.
    As far you didn't provide any sample data - check attached file for better understanding of what I'm trying to tell you
    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. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  2. Insert Command Button that will Activate Command Button on a Different Sheet
    By realvirtuality1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2016, 02:11 PM
  3. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  4. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  5. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  6. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  7. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 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