Change a value in a cell from a checkbox

江枫思渺然 提交于 2019-12-25 05:19:10

问题


I have a value in one table and a checkbox in another. I would like the value to go up by 1 when the box is checked. I want to do something like this:

=IF(C23,B4=B4+1)

but Excel throws an error. C23 is the checkbox and B4 is the number.


回答1:


You'll have to create a linked cell to the checkbox if you have not done so already (in Design Mode right click on the checkbox and see "LinkedCell" in the Properties menu). Then, when your checkbox is checked, this linked cell will return TRUE if checked or FALSE if not checked.

If you have C23 as your linked cell you can use the below formula if you have enabled iterative calculations and they are set to 1 (see File > Excel Options > Formulas > Calculation Options -- check the Enable iterative calculations box and set the maximum value to 1):

***The only catch to this is without VBA you will need a helper cell to establish what B4's initial value should be. This is usually the quickest solution and the helper cell can be the same font color as the background color of its surrounding area in your worksheet if you'd like to hide it somewhere. I have used B3 in my example of the cell address of the helper cell.

Once all of that is complete, place the following in cell B4:

=IF(C23=TRUE,B3+1,B3)

Hope this helps or at least gets you pointed in the right direction.



来源:https://stackoverflow.com/questions/19989175/change-a-value-in-a-cell-from-a-checkbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!