If Statement not working because referenced cell contains a formula

JustHooch

New Member
Joined
May 17, 2018
Messages
44
I know I have done this before but I can't remember how. I have an ActiveX control checkbox with the linked cell in G14. I need to write an IF statement in cell H14 based on if the result is TRUE or FALSE.

If G14 = FALSE then H14 = 0
If G14 = TRUE then H14 = 1

Normally I would us the formula =IF(G14="FALSE","0","1"), however I am getting a 1 in H14 not matter what is in G14. I am assuming because the result in G14 is not actually entered text.

Note I have tried with the format of cell G14 being both General and Text with the same result.

I am not using Count in H14 because I have the same scenario in row 15-20 as well, the different only being that TRUE is not always = to 1 for each row in column H.

Please help me out.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi,

As sheetspread mentioned, you have quotes around FALSE in your formula, that makes the formula Test for the Text "FALSE", Not the Logical FALSE as what's in G14, so it's Always producing 1.

You should ALSO remove the quotes around 0 and 1 in your formula, as is, they are Text 0 and 1, not numbers.
 
Upvote 0
Why not put this script in the CheckBox:

Code:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then Range("H14").Value = 1
If CheckBox1.Value = False Then Range("H14").Value = 0
End Sub
 
Last edited:
Upvote 0
Another formula option for G14 is simply
=G14*1


.. I have the same scenario in row 15-20 as well, the different only being that TRUE is not always = to 1 for each row in column H.
For those other rows, just change the 1 in the formula above to the value you want if the G column value is True.
 
Upvote 0
You're welcome, welcome to the forum.

Try Peter's way, it's simpler and does the same thing.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top