IF Statement on Excel/Google Sheets - excel

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

Related

Excel: Textjoin skip header if cell is blank

I want to use textjoin. My formula right now works until it finds a blank cell, the Header is still joined.
What I like to have is that when a cell is empty, the header is ignored.
My formula until now is this, yet I don't know how to proceed further.
=TEKST.JOIN(" + ",TRUE,$A$2:$O$2&", "&A3:O3)
The desired outcome row 2 to 4:
Material+VZ
Driver+SW-12
And for row 5:
Material+VZ
Model+X4
Drive+SW-12
Hoping someone can help me on the way.
I have tried searching stackoverflow, and approaching the formula on a different way
I guess this is what you want, put in cell E2 the following formula:
=TEXTSPLIT(TEXTJOIN("",,MAP(A2:A5, B2:B5, C2:C5, LAMBDA(a,b,c,
IF(a<>"", A1&"+"&a&",", "") & IF(b<>"", B1&"+"&b&",", "")
& IF(c<>"", C1&"+"&c&",", "")))),,",",1)
You can encapsulate the IF logic in a user LAMBDA function (ADD) as follow:
=LET(ADD, LAMBDA(title, x, IF(x<>"", title &"+"& x &",", "")),
TEXTSPLIT(TEXTJOIN("",,MAP(A2:A5, B2:B5, C2:C5, LAMBDA(a,b,c, ADD(A1,a) &
ADD(B1,b) & ADD(C1,c)))),,",",1))
Here is the output:

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

Trying to return a blank cell or data by combining VLOOKUP IFERROR & IFBLANK

I am having a little difficulty trying to return a blank cell where there is no data in a report I'm creating.
My formula is halfway there, I have successfully used the IFERROR function to remove the #N/As from my data, but the fields with nothing in are returning 0s.
My formula is
=IFERROR(VLOOKUP(C5,'Scheduler + Comments'!B:D,3,FALSE)," ")
Probably quite a simple answer to this but I'm spending way too long on this issue getting no results.
You are almost there.
You can add an if function to check if the Vlookup has blank as result and in that case return a blank.
=IFERROR(IF(VLOOKUP(C5,'Scheduler + Comments'!B:D,3,FALSE)="","",VLOOKUP(C5,'Scheduler + Comments'!B:D,3,FALSE)),"")
From my point of view, your formula is correct but i can suggest some improvements.
This may helps
Fix the range of C5 & B:D
Remove the space between " "
=IFERROR(VLOOKUP($C$5,'Scheduler + Comments'!$B:$D,3,FALSE),"")
When i use the formula i get a blank cell as you wish.

Excel IF statement is returning "FALSE"

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:

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.

Resources