Forum Discussion
VBA to output Product of two cells if checkbox is "Checked" but stay a zero value if "Unchecked"
- Nov 19, 2022
Rashaud35 it doesn't matter where the checkbox is located. you want to link to some 'other' cell and not the one you want the formula in. so in the attached I changed the 1st row to be 'linked' to D7 so in E7 is the formula =B7*C7*D7
You can then "hide" the true/false text by changing the font color to be same as fill color (you could also use custom number formatting if needed)
- I hope I have solved the problem you highlighted. Cell addresses are not the same as they were in your Excel file.
- Attached are two pictures to give you a clear view of what i did.
1. Added another column (F4)
2. Type this formula =IF(E4,B4*C4,"0") into cell F4, and drag it down.
3. Hide column E that contains the true, false strings.
4. Replace the values in cells B4 and C4, and let the checkbox in cell D4 be checked or unchecked. Confirm the answers as expected.
Figure 1- Additional column in cell F4 with new values in cells B4 & C4
Figure 2- Column E4 is hidden
Hope this clears up the problem
Regards