Having trouble with IF NOT statments work in Sheets - if-statement

this might be an easy fix but I just can't figure it out. I'm trying to get this IF statement, if the cell is not FALSE to return value, else to return a certain string. I've tried a couple of ways but I can't make the right combination. And I have a similar issue with excluding the FALSE value from a UNIQUE search statement.
This is the sample. Sorry if I'm missing on smth very obvious

Regarding your concern in setting a value if the cell is NOT FALSE, you can use this formula in Row 2:
=arrayformula(if(A2:A<>"",if(A2:A=FALSE,"Blank",iferror(year(to_date(datevalue(A2:A))),"No year found")),""))
What it does?
Check if cell value is FALSE, If yes, set cell value to "Blank", else convert the date string to value using datevalue(). Then use to_date() to convert date value into a date object. Use year() to get the year. Use iferror() to set a default value if the formula encountered an error (when your string is not a valid date string)
Loop each row using arrayformula()
Output:
Regarding filtering your data without FALSE:
=filter(A2:A,A2:A <> FALSE)
What it does?
Using filter(), filter the data if the cell value is not FALSE
Output:
Note:
You can also use UNIQUE() once you filter your data
=unique(filter(A2:A,A2:A <> FALSE))

Related

Add a conditional column in Power BI Power Query

I am trying to add a conditional column in Power BI Power Query. I have three columns with values. If all three columns return a value, then the conditional column should return true. If any column returns a null value, then I want the conditional column to return false. Newbie here and I just cannot figure it out. Any help is appreciated.
In M, add a custom column
= if [columnname1]=null or [columnname2]=null or [columnname3]=null then false else true
that assumes they are real nulls, instead of blank strings, which might require =""
Just another way to do it (Power Query M)
'Source' is the name of the previous step and you have to adapt it when inserting it.
'Column1', 'Column2' and 'Column3' are the column names you also have to adapt.
= Table.AddColumn(Source, "AllColumnsWithData", each if List.AllTrue({[Column1]<>null,[Column2]<>null,[Column3]<>null}) then true else false)

Excel ISERROR formula returns #VALUE! even when I'm using IF function to return blank

I'm using an excel formula to check for 3 different conditions when, if any one of the three are met, should return a blank cell. Even though one of the 3 conditions is being met, it still returns a #VALUE! cell which I do not want. Here is the formula:
=IF(OR(BDP(A18&" CUSIP", "YLD_CUR_MID")="#N/A Field Not Applicable",[#CUSIP]="", ISERROR(BDP(A18&" CUSIP", "YLD_CUR_MID"))=TRUE),"",BDP(A18&" CUSIP", "YLD_CUR_MID")/100)
Any and all help is greatly appreciated!
Use:
=IF(OR([#CUSIP]="",IFERROR(BDP(A18&" CUSIP", "YLD_CUR_MID")="#N/A Field Not Applicable",TRUE)),"",BDP(A18&" CUSIP", "YLD_CUR_MID")/100)

Conditionally format cell if value entered already appears in same row, next column which is CSV

I'm want to conditionally format A3:A if the value entered in A3:A already appears in B3:B, which contains CSV, >1 time.
(A3:A will be CONCATENATED to B3:B, so the value will automatically appear at least once.)
Basically, if the value is not already present, there will be no formatting and I know to go ahead and add (leave it). If it is present, format the cell to alert me not to add (or delete). There may be numerous values in some cells and not so easy to glance to see if the value in question is already present.
I attempted to use REGEXMATCH, but not really sure how to switch the TRUE to a numeric value.
=IF(LEN(A3),REGEXMATCH(B3,A3),)
I've also found other formulas using COUNTIF and COUNTA that perform a similar action, but none that consider CSV.
My sheet
custom formula for CF:
=ARRAYFORMULA(REGEXMATCH(A3,TEXTJOIN("|",1,TRANSPOSE(QUERY(QUERY(TRANSPOSE(TRIM(
SPLIT(B3,","))), "select Col1,count(Col1) group by Col1"),
"select Col1 where Col2 > 1", 0)))))

Checking if any value in Column is equal to Todays Date

I'm working in Google Sheets and I am trying to determine if any value of dates listed in the column is equal to Today's Date.
I have tried using the COUNTIF formula the ISDATE formula and the IF formula against the value of TODAY() and nothing seems to be working right.
=IF('Invoices-Quickbooks-Data'!L:L,ISDATE(TODAY()),true)
This formula actually works the best for me. I would expect it to calculate if any of the values equal Today's Date. Ironically this tells me that the answer is TRUE even when none of the dates actually match Today's date so I am not sure what is going on.
First, the reason why your formula is always returning true is because ISDATE(TODAY()) will always return true (when is today not a date?) and furthermore, you can't use an IF statement like that to query a whole column. The first argument to IF is a condition, and a column range is not a condition.
To apply a function over a range, you want to use an ARRAYFORMULA. Here is how you would check a range of cells to see if any value in the column (or range) contains a date equal to today:
=IFERROR(VLOOKUP(TRUE,ARRAYFORMULA(IFERROR(DATEVALUE(A:A)=TODAY(),FALSE)),1,FALSE),FALSE)
Just replace A:A with the range you want to check. The return of an ArrayFormula is an array, which is why I have to use VLOOKUP to check for any TRUE values inside it.
Advanced solution:
A really cool feature in sheets is the query() function, which essentially lets you run a SQL-like query over a range of cells. I like it because it makes formulaes very readable - for example, the entire ARRAYFORMULA solution above can be replaced with:
=IFERROR(QUERY('Invoices-Quickbooks-Data'!L:L,"select count(L) where dateDiff(L,now()) = 0 label count(L) ''",-1) > 0,FALSE)
you can check it with just simple IF formula:
=ARRAYFORMULA(IF(LEN(A2:A), IF(A2:A=TODAY(), TRUE), ))
=ARRAYFORMULA(IF(A2:A=TODAY(), TRUE, ))

How to turn this formula into an ArrayFormula so it applies down the column

I have a formula that will work when applied to just one cell but stops working when I try to make it an array formula so it applies down the entire column.
I am trying to check if the date in column E is today and if column A is true or false. Based on that, I want column C to read true or false.
I have tried to apply the column to each cell individually by dragging it down, and that works fine. But it will not work with an ArrayFormula.
=AND(INT(E2:E)=TODAY(),A2:A=FALSE)
When I apply ArrayForumla the result comes back FALSE even when it should be positive.
I expect it to automatically populate each cell in the column with that formula and return the correct TRUE/FALSE result.
G2:
=ARRAYFORMULA(IF(LEN(E3:E), E2:E+F2:F, ))
H2:
=ARRAYFORMULA(IF((INT(E2:E)=TODAY())+(INT(G2:G)=TODAY()), A2:A, ))
Please try:
=ArrayFormula((A2:A)*(int(D2:D)=TODAY())>0)