How to execute If condition in excel with Null Value [duplicate] - excel

Currently trying to compare two dates to work out whether a document has been submitted within SLA dates
I have 3 cells,
H5 (SLA target date)
T5 (Document submitted date)
U5 (In SLA or Not) Y/N
Using really simple formula in
U5 of =IF(T5-H5 <= 1, "Y", "N")
But the formula is returning true down the column for cells which contain no content yet.
How do I return either a Y, N, or 0 (or blank) in column U?

=IF(OR(ISBLANK(T5),ISBLANK(H5)),0,IF(T5-H5<=1,"Y","N"))
You can change 0 with "" if you want the cell to be blank.

You should add a check for blank cells
=if(or(isblank(T5), isblank(H5)), "blank", IF(T5-H5 <= 1, "Y", "N"))

If both could be empty:
=IF(COUNT(H5,T5)=2,IF(T5-H5<=1,"Y","N"),0)
Or if H column would always be populated:
=IF(T5<>"",IF(T5-H5<=1,"Y","N"),0)

Related

IF Function with multiple statements - If cell contains "0" = "BE", If cell is greater than "0" = "W", If cell is less than "0" = "L"

I'm having trouble trying to get this formula to work.
I have been using this formula =IF(A2="0","BE",IF(A3<=0,"L",IF(A4>=1,"W"))) But it seems something is wrong as it's not returning the correct values.
So basically, If a cell contains "0" I need it to return "BE" - Above "0" I need it to return "W"
& Below "0" I need it to return "L"
https://docs.google.com/spreadsheets/d/1EHbtNmfZ95TgMuSU8sCx8AWKW2zhH3ubXPGu03P1w9g/edit?usp=sharing
I hope this makes sense!
Thank you in advance! :)
Data must be formatted as numbers**
=ArrayFormula(IFS(A2:A11="","",A2:A11=0,"BE",A2:A11>0,"W",A2:A11<0,"L"))
It will A2 in every IF() clause the drag and down the formula. Also for second IF( you can use <=, you have to use only < (less operator). Try below formula.
=IF(A2=0,"BE",IF(A2<0,"L",IF(A2>0,"W","")))
Issue:
IF formula needs 3 parameters, namely the condition, if value, and else value. You lack the else value on the last IF formula so it failed.
Fix:
Basically, we can optimize the formula and only need 2 IF formulas here. Why you may ask? Two nested IF formulas can already cover 3 conditions. We just need to properly order the conditions so 2 IF formulas will suffice.
Explanation:
Since the middle is 0, we need to use it for the first condition. We will first identify if it belongs to which side (negative or positive) so we can minimize the outcome.
I used negative as my first condition. If TRUE, it will return "L", If not, we only have 2 remaining possible conditions left. So we will further check if it is positive. If it is, then return "W", if it isn't negative or positive, then it is automatically 0 and we return "BE".
Formula:
=IF(A2 < 0, "L", IF(A2 > 0, "W", "BE"))
Output:
Optimization:
I do recommend however that you use ARRAYFORMULA so you don't need to copy/drag the formula to every cell. By doing this, you only need to modify the formula of the first row where the data starts. And it will automatically populate the values below.
Formula:
=ARRAYFORMULA(IF(ISBLANK(A2:A), "", IF(A2:A < 0, "L", IF(A2:A > 0, "W", "BE"))))
Output:
Note:
when using ARRAYFORMULA, we just need to additionally check if the data is blank since it will go until the last row available if not added.

Excel - Find the correct value out of multiple

I'm currently trying to extract a set of values corresponding to some other but can't succeed.
On my sheet, I have 2 columns (Country (C) / online(D))
Wrong
There are multiple values.
In columns F and G, I display the results.
I'm using a formula with INDEX/MATCH to do this but the problem it only takes into account the first value found (so for country BEL, first value is "yes", it will show "yes" in column G). My formula is
=INDEX(D2:D8,MATCH(F2:F4,C2:C8,0))
What I'd like is if for BEL there are "yes" and "no" values, the result will show me "no". so "yes" is a default value and if there are "yes" and "no", since there is a different value for BEL, it will show this other value and give this
Right
any idea how to do this ?
Hope it's clear.
Thanks a lot for your help.
You can use COUNTIFS to get the number of matches where ONLINE = "no" for each country, then use that as an input to an IF statement that will output "no" if the count of "no" in the table is > 0
here is a formula to get started:
=IF(COUNTIFS(B:B,"=no",A:A,E4)>0,"no","yes")
COL A has the Countries, B the Online state, and E is the summary section

Excel IF Function, True, False, or Blank

Currently trying to compare two dates to work out whether a document has been submitted within SLA dates
I have 3 cells,
H5 (SLA target date)
T5 (Document submitted date)
U5 (In SLA or Not) Y/N
Using really simple formula in
U5 of =IF(T5-H5 <= 1, "Y", "N")
But the formula is returning true down the column for cells which contain no content yet.
How do I return either a Y, N, or 0 (or blank) in column U?
=IF(OR(ISBLANK(T5),ISBLANK(H5)),0,IF(T5-H5<=1,"Y","N"))
You can change 0 with "" if you want the cell to be blank.
You should add a check for blank cells
=if(or(isblank(T5), isblank(H5)), "blank", IF(T5-H5 <= 1, "Y", "N"))
If both could be empty:
=IF(COUNT(H5,T5)=2,IF(T5-H5<=1,"Y","N"),0)
Or if H column would always be populated:
=IF(T5<>"",IF(T5-H5<=1,"Y","N"),0)

If statement that changes value of another cell than where the function is contained

I have a range of cells that either have a "Y" or "N" in them. I als0 have a "Score" cell that starts with a value of 4. I want to search those cells and if they contain a single "N" then I want the value in cell $S$17 (Score Cell) to be subtracted by 1. If they are all "Y" then I want the number value in $S$17 to remain the same. The formula itself is in cell $S$17 so when I have this formula =IF(COUNTIF(S2:S6,"N"),SUM(S17,-1),S17) it is giving me a circular Reference error. Is there a way to post this formula in a different cell but have the output posted in cell $S$17? I was thinking something like =IF(COUNTIF(S2:S6,"N"),S17 = SUM(S17,-1),S17). I know this isn't correct syntax but thats the idea. Or if thats not possible just avoid the circular reference.
Pretty simple answer here if I understand your Q:
If you want to subtract 1 for EACH "N":
= 4 - COUNTIF(S2:S6, "N")
If you want to ONLY subtract 1 for ANY quantity of "N":
= IF(COUNTIF(S2:S6, "N")>0, 3, 4)

How do I test the results of an operation for a value?

Techies--
In a nutshell, I have a condition where if I encounter a negative value after operating against other cells, I want to zero out that cell and operate against another set of cells. This formula does not work, but here is what the intent is:
=IF((H3+((D4+D5+D6)*-1)) < 0;M6=0;N6=C4+C5+C6 + (D6)*-1 )
If I add d4-d6 multiplied by -1, this gives me a credit against a debit value I have in H3. Whenever this value exceeds the positive value of the debit in H3, I want zero out the cell (M6) and in the cell next to it (N6), I want to add another set of debits and subtract out the credit I found in D6.
Does anyone know how to do this, or something similar in EXCEL 2010?
In Cell M6 You should have this
=IF((H3+((D4+D5+D6)-1))<0, 0, "")
In Cell N6 You should have this
=IF(NOT(M6 = 0), C4+C5+C6 + (D6)-1, "")

Resources