Forum Discussion

maxlovesneptune's avatar
maxlovesneptune
Copper Contributor
Jul 16, 2023

Excel Checkboxes help!

Hi yall!

 

I am making an inventory of my belongings so I can make a packing list for college. There are two columns of checkboxes, one for whether or not an item is going to college, and whether or not it has been packed yet. Is it possible for the second column to appear in a row only when the first is selected? Like if I select that an item is going to college, could the checkbox on whether it is packed or not appear? I dont want the second column of checkboxes to be available on rows where an item isn't going with me.

 

Also, is it possible to center a checkbox in a cell? One more, is it possible to link checkboxes to rows so that when I drag down extra rows to the table, the checkboxes are added in the correct columns?

 

I know this is a lot of questions, but I appreciate any help! Thank you guys !!

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor
    Like if I select that an item is going to college, could the checkbox on whether it is packed or not appear?

    Do you mean that checkbox only for being selected but not printable?
    • maxlovesneptune's avatar
      maxlovesneptune
      Copper Contributor
      I have two columns of checkboxes, and I want the second column in a specific row to appear only when the first column in that row is selected yes. This is so it isn't an option to pick "packed" on items that are staying home!
  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    maxlovesneptune 

    If I got it right from your text, here is how to accomplish it:

    (If what is meant is not what you want, then like the previous user suggested, I recommend giving a bit more and more specific information about your project.)

    1. Showing the second column of checkboxes based on the selection in the first column:
      • Assume the first column of checkboxes is in column A and the second column of checkboxes is in column B.
      • Select the range where you want the second column of checkboxes to appear (e.g., B2:B100).
      • Go to the "Home" tab and click on "Conditional Formatting" in the "Styles" group.
      • Choose "New Rule" and select "Use a formula to determine which cells to format."
      • In the "Format values where this formula is true" box, enter the following formula:

    =$A2=TRUE

    This formula assumes that the checkbox in column A for the same row is selected.

      • Click on the "Format" button and go to the "Fill" tab.
      • Choose the background color you want for the checkboxes in column B.
      • Click "OK" to close the "Format Cells" dialog box.
      • Click "OK" to close the "New Formatting Rule" dialog box.
      • Now, when you select a checkbox in column A for a specific row, the corresponding checkbox in column B will appear.
    1. Centering a checkbox in a cell:
      • Right-click on the checkbox and select "Edit Text."
      • In the "Edit Text" dialog box, delete any text present and click "OK."
      • Right-click on the checkbox again and select "Format Control."
      • In the "Control" tab, go to the "Alignment" section.
      • Choose the "Center" option for both the "Horizontal" and "Vertical" alignments.
      • Click "OK" to close the "Format Control" dialog box.
      • The checkbox will now be centered within the cell.
    2. Linking checkboxes to rows for easy addition with dragging:
      • Place the checkboxes for the first row manually in columns A and B.
      • Select both checkboxes and drag the fill handle (the small square in the bottom-right corner) down to the desired number of rows.
      • Excel will automatically adjust the references and add checkboxes to the corresponding rows.

    By following these steps, you should be able to have the second column of checkboxes appear based on the selection in the first column, center the checkboxes within cells, and easily add checkboxes to new rows by dragging. The text and the steps are the result of various AI's put together.

     

    My answers are voluntary and without guarantee!

     

    Good luck with your college packing list!

    • maxlovesneptune's avatar
      maxlovesneptune
      Copper Contributor
      Showing the second column of checkboxes based on the selection in the first column:
      Assume the first column of checkboxes is in column A and the second column of checkboxes is in column B.
      Select the range where you want the second column of checkboxes to appear (e.g., B2:B100).
      Go to the "Home" tab and click on "Conditional Formatting" in the "Styles" group.
      Choose "New Rule" and select "Use a formula to determine which cells to format."
      In the "Format values where this formula is true" box, enter the following formula:
      =$A2=TRUE

      This formula assumes that the checkbox in column A for the same row is selected.

      Click on the "Format" button and go to the "Fill" tab.
      Choose the background color you want for the checkboxes in column B.
      Click "OK" to close the "Format Cells" dialog box.
      Click "OK" to close the "New Formatting Rule" dialog box.
      Now, when you select a checkbox in column A for a specific row, the corresponding checkbox in column B will appear.

      This didn't work, will this only work if it isn't in a table?
      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor

        maxlovesneptune 

        The method I provided for showing the second column of checkboxes based on the selection in the first column may not work directly with tables in Excel. Conditional formatting behaves differently when applied to tables compared to regular cell ranges.

        Instead, let us try a different approach using the "IF" function and cell references to achieve the desired functionality.

        Here is how you can do it:

        Assume you have the checkboxes in columns A and B of a table. Column A contains the checkboxes for whether an item is going to college, and column B will contain checkboxes for whether the item has been packed.

        1. In cell C2 (or any cell outside of the table), enter the following formula: =IF(A2=TRUE,TRUE,FALSE)
        2. Drag the fill handle of cell C2 down to cover the entire range of the table (e.g., C2:C100). This will copy the formula to all rows in the table.
        3. Now, in cell B2 (or any cell in column B of the table), insert a checkbox from the "Form Controls" section of the "Developer" tab. Right-click on the checkbox, choose "Format Control," and go to the "Control" tab.
        4. In the "Cell link" field, enter the cell reference to the corresponding cell in column C (e.g., C2). This link will be updated automatically as you drag the checkbox down to other rows.
        5. Now, when you select a checkbox in column A for a specific row, the corresponding checkbox in column B should appear based on the formula in column C.

        By using this method, you can avoid the conditional formatting limitation with tables and achieve the desired functionality of showing the second column of checkboxes based on the selection in the first column. Remember to adjust the cell references as needed to fit your specific table range.

        Additionally, regarding centering checkboxes within cells, unfortunately, it's not directly possible to center them using the native "Form Controls" checkboxes. However, you can use ActiveX checkboxes instead, which provide more formatting options and can be centered. To use ActiveX checkboxes, you'll need to enable the "Developer" tab in Excel and insert the checkboxes from there.

        To enable the "Developer" tab, follow these steps:

        1. Go to "Excel Preferences" from the "Excel" menu.
        2. Click on "Ribbon & Toolbar" in the "Authoring" section.
        3. Check the "Developer" option under "Main Tabs."

        Once the "Developer" tab is enabled, you can insert ActiveX checkboxes and adjust their alignment within cells. The text and the steps are the result of various AI's put together.

        My answers are voluntary and without guarantee!

        Hope this will help you.

Resources