Excel IF statement is returning "FALSE" - excel

I am trying to write a statement which will read the content of the adjacent cells and select a value depending on the results to punctuate a paragraph. Just like the below sentence is laid out.
Statement 1, Statement 2, Statement 3.
A comma is included if the next statement has content. A full stop is included if the next statement does not have content. Nothing is included if the next and previous statements do not have content. I have used the formula below, but the bit that's supposed to add the full stop is returning FALSE:
=IF(A1<>"",IF(C1<>"",", "),IF(A1<>"",IF(C1="",". "),IF(A1="",IF(C1="",""))))
What have I done wrong?

I believe you have overcomplicated your formula. For example you test up to 3 times if A1 is blank
Are you trying to achieve this ?
=IF(A1<>"",IF(C1<>"","; ",""),IF(C1="",". ",""))
if A1 is not blank and C1 is not blank = ;
if A1 is not blank and C1 is blank = nothing
if A1 is blank and C1 is blank = .
if A1 is blank and C1 is not blank = nothing

The IF statement has this format: =IF(<Statement>, <Value_If_True>, <Value_If_False>)
If we break your code down in the same way, we get this:
=IF(<Statement1>, IF_TRUE1(<Statement2>, <Value_If_True2>), IF_FALSE1(<Statement3>, IF_TRUE3(<Statement4>, <Value_If_True4>), IF_FALSE3(<Statement5>, IF_TRUE5(<Statement6>, <Value_If_True6>))))
The missing <Value_If_False> will return FALSE by default.
Now, that might be a bit hard to read, so here's another layout:
Hopefully you can see all of the duplicate "question" nodes there - and also that the "." is impossible to reach, because it requires that A1<>"" is FALSE, and also TRUE.
Rewriting your code, there is still 1 "missing" terminator:
=IF(A1="", IF(C1="", "", FALSE), IF(C1="", ".", ", "))
(Or, if you want to be really fancy, use a CHOOSE statement:)
=CHOOSE(1+(A1="")+2*(C1=""), ", ", FALSE, ".", "")

This part of your formula seems redundant as it is already captured in the initial logical arguments:
IF(A1<>"",IF(C1="",". "),IF(A1="",IF(C1="","")))
I might not understand your objective entirely, but this should do the trick:
I'm assuming statements here are defined by inputs into columns A,B & C and column A has to be filled first.
=IF(A1="","",IF(AND(B1="",C1=""),". ",", "))
If I'm way off, do share your table/sheet structure with desired results.

Ok, had a go at this just to see:
=IF(AND(A1="",C1=""),"",IF(AND(A1<>"",C1<>""),A1&";"&C1,A1&C1&"."))
And if both are not blank, then they should be separated by ";" and finished with "." ...
=IF(AND(A1="",C1=""),"",IF(AND(A1<>"",C1<>""),A1&";"&C1&".",A1&C1&"."))
See:

Related

Combining cells unless a cell contains certain text

I have an Excel spreadsheet with 7 cells (in a column) with data in, these are C13 to C19
I have a formula that combines all the data in these cells together and puts it into one cell, this formula is =C13&", "&C14&", "&C15&", "&C16&", "&C17&", "&C18&", "&C19 and works fine. However, can I alter this formula to miss out on any cell that contains the text "Nothing else carby"?
You may, in Excel 2019, use:
=TEXTJOIN(", ",,IF(C13:C19<>"Nothing else carby",C13:C19,""))
If "Nothing else carby" can be a substring inside a cell's value, try:
=TEXTJOIN(", ",,IF(ISNUMBER(FIND("Nothing else carby",C13:C19)),"",C13:C19))
Confirm through CtrlShiftEnter
The formula should not be that long, as you can see:
=TEXTJOIN(",",TRUE,IF(C13:C19="Nothing","", C13:C19))
(I just used "Nothing" instead of the whole word for readability reasons.)
Explanation of the parameters:
"," : delimiter: between every cell content, a comma is added.
TRUE : treatment of blank cells (don't put them).
IF (...) : In case cell content is "Nothing", put an empty string.
In combination with the previous parameter,
just one comma will be put in the result:
"a,b,c,e,f,g" and not "a,b,c,,e,f,g" (see result).
Used data:
a
b
c
Nothing
e
f
g
Result:
a,b,c,e,f,g

How to change value of a cell up to another

I have a column in a sheet,
I want to change the value of the cell of another sheet with rules:
If the text is: "Won" or "Lost" or "Cancel" Then get these text values into the target cell.
Else values then get the value of right above the From cell.
My syntax like this:
=if('Weekly Plan'!F5 = "Won" or 'Weekly Plan'!F5 = "Lost" or 'Weekly Plan'!F5 = "Cancel";'Weekly Plan'!F5;'Weekly Plan'!F4)
But it has given me the error:
Error
Formula parses error.
Invalid:
Input must fall within the specified range
I don't know how to fix this
Thanks!
Maybe something like that?
=IF(OR(F5="Won",F5="Lost",F5="Cancel"),F5,F4)
You seem not to understand the way logical operators work in Excel formulas:
It's not: A OR B OR C
But: OR(A;B;C)
Or (in case you might need and AND-operator):
It's not: A AND B AND C
But: AND(A;B;C)
Keep out: the semicolon can be replaced by a comma, this is determined by your locale.
Good luck

IF Statement on Excel/Google Sheets

I'm trying to find a formula in which K4 returns completely blank when J4 is empty. As you can see in the image, it's returning £0.00, but I need it to be blank?
this is how you do it in Google Sheets:
=IF(LEN(J4), IF(J4="Won", H4*I4, 0)+IF(J4="Lost", 0, 0), )
and whole your formula can be shortened to:
=IF(LEN(J4), IF(J4="Won", H4*I4, 0), )
If you want to return a true blank, just skip the return argument
For instance
IF(J4 = " ",)
If this does not work due to formatting disagreements with the above equation, you can return a blank with the below as well
IF(J4 = " ", IFERROR(0/0))
I might be wrong, but I don't think you can enter a formula and get a completely blank return value.
The next best thing you can do is return a zero-length string "" -- which isn't the same as a blank cell but might work for you nonetheless.
Maybe you can nest your formula in =IF(ISBLANK(K4),"",<put the rest of your formula here>).

Excel Formula For If

Ok. I'm Having A Problem With A formula That Seems Really Basic. It Uses The If Function. Here's What I Need.
If(b2:b50<>"",IF(b2:b50"607734",e2:e50="Patriot"))
So Basically If Between b2-b50 Has The Number "607734" I Want e2-e50 To Display "Patriot"
You need to put the IF statement in the cell where you want the value. For example, in E2, enter =IF(B2="607734", "Patriot", "") and drag it down to E50.
For each cell you have to enter the formula, which goes like this.
If(logical_test,value if true, value if false)
So, if b2 =607734 then c2 = "Patriot" else c2= " "
Now as formula we can write this as
if(b2=607734,"Patriot","")
similarly, for other cells(c3,c4,c5,c6....c50) we have formula in each cell as :
if(b3=607734,"Patriot","")
if(b4=607734,"Patriot","")
if(b5=607734,"Patriot","")
if(b6=607734,"Patriot","")
........
........
if(b50=607734,"Patriot","")
Your IF statements don't satisfy the else conclusion.
The format of an IF statement in Excel is as follows:
IF(parameter, what to do if parameter is true, what to do if parameter is false).
Right now you've filled in the first two variables for the IF command, but you left the third blank.
e.g.
Could have:
If(b2:b50<>"",IF(b2:b50"607734",e2:e50="Patriot", " ")," ")
And in that case it would put a space in the cell if the first two conditions are not met.

Make "Cell A" check value of "cell B" then return value of "Cell C"

Been looking around and can't find anything for it. I am still very new to all this so I apologize if its a simple solution.
This is an example of what I was trying to do:
=IF(E4=True,0,=I16)
Where E4 is a list of names and I16 is the sum of a set of items.
What I want is if E4 = True then show value of I16 , if not show 0
All my calculations are done elsewhere this is just a summary that I want the option to either turn on or off by changing the value of E4 from true to false.
Hopefully I explained it well.
the syntax of the excel if statement is =IF(LOGICAL_TEST,[value if true],[value if false]) so there is no need for another = within the syntax.
You will need " around anything you want as text in the form of:
=IF(A1 = "Bob","Robert","Not Bob")
but to show values of other cells you simply need the cell name:
=IF(A1=32,b1,c1)
If you want to nest the logic with another if statement you place the IF(logic,[true],[false]) within the true or false location as such:
=IF(A1 = 5,IF(b2>a1,b1,"less than"),c1)

Resources