Help with True/False Formula

McNeil87

New Member
Joined
Dec 6, 2019
Messages
22
Office Version
2016
Platform
Windows, MacOS
Hello!

Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True, IF(AH2=TRUE,TRUE,FALSE),TRUE). The result brings True, but it actually needs to be False (for this specific case). Am I missing a 'False' statement after the first logical test? Any recommendations how I should write this would be great. All the data returns True, and that is not correct.

Thank you!
 

Attachments

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,174
Office Version
2013
Platform
Windows
Maybe this

VBA Code:
=IF(AND(AG2=TRUE, AH2=TRUE),TRUE,FALSE)
 

McNeil87

New Member
Joined
Dec 6, 2019
Messages
22
Office Version
2016
Platform
Windows, MacOS
Thank you. Can you explain what break this down? Does this mean, IF AG2=True, and AH2=True, then return 'True', Else ' false'? The ANd statement returns will return true if both criteria are true, correct?
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,174
Office Version
2013
Platform
Windows
Yes, you are correct.
If either / neither are TRUE then it will return FALSE
 

6StringJazzer

Active Member
Joined
Jan 27, 2010
Messages
372
I think you are all tangled up with Boolean logic. You are saying what your formula should return, but you do not tell us the values for AG or AH, or why you think this formula should return FALSE.

First of all let's look at this expression within your formula:
AG=TRUE
So AG must be TRUE or FALSE. If it is TRUE, you want the result of this comparison to be TRUE. That is exactly the same as just
AG

Similarly,
IF(AH=TRUE,TRUE,FALSE)
gives the same result as just
AH

Judging from your screenshot, your formula is
=IF(AG2=TRUE,IF(AH=TRUE,TRUE,FALSE),TRUE)

This is logically equivalent to
=IF(AG,AH,TRUE)

Now. What are the values of AG and AH? If your formula is giving you a different result than you expect, please explain the logic you want to use.

Here is the truth table for your formula:

AGAHRESULT
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUETRUE
FALSEFALSETRUE
 

McNeil87

New Member
Joined
Dec 6, 2019
Messages
22
Office Version
2016
Platform
Windows, MacOS
Cell AG is a contract , and AH is a program.. So, IF Cell AG is a contract and part of a program, then return True. If Cell AG (contract) is a contract, BUT not part of a program, then return 'False.' IF AG is not a contract, and is not part of a program, return False.
 

McNeil87

New Member
Joined
Dec 6, 2019
Messages
22
Office Version
2016
Platform
Windows, MacOS
I think you are all tangled up with Boolean logic. You are saying what your formula should return, but you do not tell us the values for AG or AH, or why you think this formula should return FALSE.

First of all let's look at this expression within your formula:
AG=TRUE
So AG must be TRUE or FALSE. If it is TRUE, you want the result of this comparison to be TRUE. That is exactly the same as just
AG

Similarly,
IF(AH=TRUE,TRUE,FALSE)
gives the same result as just
AH

Judging from your screenshot, your formula is
=IF(AG2=TRUE,IF(AH=TRUE,TRUE,FALSE),TRUE)

This is logically equivalent to
=IF(AG,AH,TRUE)

Now. What are the values of AG and AH? If your formula is giving you a different result than you expect, please explain the logic you want to use.

Here is the truth table for your formula:

AGAHRESULT
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUETRUE
FALSEFALSETRUE

Cell AG is a contract , and AH is a program.. So, IF Cell AG is a contract and part of a program, then return True. If Cell AG (contract) is a contract, BUT not part of a program, then return 'False.' IF AG is not a contract, and is not part of a program, return False.
 

McNeil87

New Member
Joined
Dec 6, 2019
Messages
22
Office Version
2016
Platform
Windows, MacOS
Cell AG is a contract , and AH is a program.. So, IF Cell AG is a contract and part of a program, then return True. If Cell AG (contract) is a contract, BUT not part of a program, then return 'False.'
I think you are all tangled up with Boolean logic. You are saying what your formula should return, but you do not tell us the values for AG or AH, or why you think this formula should return FALSE.

First of all let's look at this expression within your formula:
AG=TRUE
So AG must be TRUE or FALSE. If it is TRUE, you want the result of this comparison to be TRUE. That is exactly the same as just
AG

Similarly,
IF(AH=TRUE,TRUE,FALSE)
gives the same result as just
AH

Judging from your screenshot, your formula is
=IF(AG2=TRUE,IF(AH=TRUE,TRUE,FALSE),TRUE)

This is logically equivalent to
=IF(AG,AH,TRUE)

Now. What are the values of AG and AH? If your formula is giving you a different result than you expect, please explain the logic you want to use.

Here is the truth table for your formula:

AGAHRESULT
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUETRUE
FALSEFALSETRUE

IF AG is not a contract, and is not part of a program, return False.
Looking at your table further, your table is correct. I have both cells as a 'False' Statements, and the result needs to return true.

I am stumped.
 

Forum statistics

Threads
1,081,856
Messages
5,361,718
Members
400,650
Latest member
tcisrly

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top