从复选框更改单元格中的值 [英] Change a value in a cell from a checkbox

查看:200
本文介绍了从复选框更改单元格中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个表中有一个值,在另一个表中有一个复选框。当选中复选框时,我希望值增加1。我想做这样的事情:

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)

但Excel会抛出错误。

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

推荐答案

如果你有复选框,你必须创建一个链接的单元格没有这样做(在设计模式右键单击复选框,并看到LinkedCell在属性菜单)。

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.

如果您有C23作为链接的单元格,您可以使用下面的链接单元格公式如果已启用迭代计算并将它们设置为1(请参阅文件> Excel选项>公式>计算选项 - 选中启用迭代计算框并将最大值设置为1):

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):

***唯一的抓住是没有VBA,你需要一个帮助单元来确定B4的初始值应该是什么。这通常是最快的解决方案,并且辅助单元可以是与您的工作表中的周围区域的背景颜色相同的字体颜色,如果你想要隐藏它在某个地方。

***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.

完成所有这些操作后,将以下内容放在单元格B4中:

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.

这篇关于从复选框更改单元格中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆