In Tableau I am struggling to replace a null/empty value with O. Tableau's ZN(expression) is still just returning a column with all the same empty/null values. Anything else I have tried to do has also been unsuccessful. Has anyone ever experienced this problem and was able to fix it.
Is it a numeric column where you're using ZN? You can also try using IFNULL() instead.
Related
I currently have a dataset filled with the following pattern:
My goal is to get each value into a different cell.
I have tried with the following formula, but it's not yielded the results I am looking for.
=SPLIT(D8,"[Stock]",FALSE,FALSE)
I would appreciate any guidance on how I can get to the ideal output, using Google Sheets.
Thank you in advance!
I will assume here from your post that your original data runs D8:D.
If you want to retain [Stock] in each entry, try the following in the Row-8 cell of a column that is otherwise empty from Row 8 downward:
=ArrayFormula(IF(D8:D="",,TRIM(SPLIT(REGEXREPLACE(D8:D&"~","(\[Stock\]).","$1~"),"~",1,1))))
If you don't want to retain [Stock] in each entry, use this version:
=ArrayFormula(IF(D8:D="",,TRIM(SPLIT(REGEXREPLACE(D8:D&"~","\[Stock\].","~"),"~",1,1))))
These formulas don't function based on using any punctuation at all as markers. They also assure that you don't wind up with blank (and therefore unusable) cells interspersed for ending SPLITs.
, only used in the separator
=ARRAYFORMULA(SPLIT(D8:D,", ",FALSE))
, used also in each string ([stock] will be replaced)
=ARRAYFORMULA(SPLIT(D8:D," [Stock], ",FALSE))
, used also in each string ([stock] will not be replaced)
=ArrayFormula(SPLIT(REGEXREPLACE(M9:M11,"(\[Stock\]), ","$1♦"),"♦"))
use:
=INDEX(TRIM(IFNA(SPLIT(D8:D; ","))))
I'm trying to use the following IFS statement
=IFS(REGEXMATCH(B2,"football"),"brown",REGEXMATCH(B2,"baseball"),"white")
but Google Sheets keeps saying the syntax is wrong. What is wrong with this?
Column B is a text column.
Other similar posts did not work for me.
The formula works fine.
You probably need to change it (depending on your locale) to:
=IFS(REGEXMATCH(D2;"football");"brown";REGEXMATCH(D2;"baseball");"white")
Another improvement you may make is to wrap it in the IFNA function
=IFNA(IFS(REGEXMATCH(D2,"football"),"brown",REGEXMATCH(D2,"baseball"),"white"),"No match")
I am trying to change the value of cell B1 depending on if cell A1's value is found in another spreadsheet. If there is a match, I want the cell to say "banned". If A1 isn't found in the other spreadsheet, I want it to say "active'.
I've been playing around with this
=if((VLOOKUP(A3,IMPORTRANGE("https://docs.google.com/xyz","ALL BANNED ACCOUNTS!$G$2:$G$300"),1,false))=A3,"Banned","Active")
and can only get it to return "Banned". If there is no match, it always returns #N/A.
How can I remedy this?
Thanks!
Try changing "FALSE" TO "TRUE". I have found that VLOOKUP behaves erratically, and simply changing the [is_sorted] value helps.
Also, this may or may not make a difference, but you have an extra set of parentheses in your formula:
=if(VLOOKUP(A3,IMPORTRANGE("https://docs.google.com/xyz","ALL BANNED
ACCOUNTS!$G$2:$G$300"),1,false)=A3,"Banned","Active")
This is an old question, but in case it helps someone, since you are using VLOOKUP in one column, the only choices are that it equals A3, or that it isn't found, and if it isn't found, VLOOKUP fails, rather than equaling something else. Therefore, you can use this formula:
=iferror(if(VLOOKUP(A3,IMPORTRANGE("https://docs.google.com/xyz","ALL BANNED
ACCOUNTS!$G$2:$G$300"),1,false)=A3,"Banned","irrelevant"),"Active")
Note that "irrelevant" can be changed to anything, i.e. 0, etc. This result will never happen, as if VLOOKUP isn't equal to the search cell (in this case, A3), it will throw an error. So, "Active" as the result if there's an error will show rather than the value if VLOOKUP is false (since it can't be).
Hopefully this helps someone!
I am attempting to extract dates from a free-text field (because our process is awesome like that :\ ) and keep hitting Teradata error 6706. The regex I'm using is: REGEXP_SUBSTR(original_field,'(\d{2})\/(\d{2})\/(\d{4})',1) AS new_field. I'm unsure of the field's type HELP TABLE has a blank in the Type column for the field.
I've already tried converting using TRANSLATE(col USING LATIN_TO_UNICODE), as well as UNICODE_TO_LATIN, those both actually cause the error by themselves. A straight CAST(original_field AS VARCHAR(255)) doesn't fix the issue, though that cast does work. I've also tried stripping various special characters (new-line, carriage return, etc.) from the field before letting the REGEXP_SUBSTR take a crack at it, both by itself and with the CAST & TRANSLATEs I already mentioned.
At this point I'm not sure what the issue could be, and could use some guidance on additional options to try.
The final version that worked ended up being
, CASE
WHEN TRANSLATE_CHK(field USING LATIN_TO_UNICODE) = 0 THEN
REGEXP_SUBSTR(TRANSLATE(field USING LATIN_TO_UNICODE),'(\d{2})\/(\d{2})\/(\d{4})',1)
ELSE NULL
END AS Ref_Date
For whatever reason, using a TRIM inside the TRANSLATE seems to cause an issue. Only once I striped any and all functions from inside the TRANSLATE did the TRANSLATE, and thus the REGEXP_SUBSTR, work.
I asked for help on another formula earlier which has lead to another head scratcher for me. I'm sure there is probably a way to use IFERROR somewhere in the formula below, but I can't seem to figure out where. I have a few columns returning #N/A that I just need to be blank.
Everything is working how it should except for the error. I have another formula feeding off of the results of this formula that I need to populate either Y or N based on the results. The #N/A is throwing some of them off.
=IF(J2="",VLOOKUP(B2,Sheet1!B:F,5,FALSE),"PICKED UP")
Just wrap it like this:
=IF(J2="",IFERROR(VLOOKUP(B2,Sheet1!B:F,5,0),"Error msg here"),"PICKED UP")
IFERROR will evaluate the first expression (here, it's the VLOOKUP) and if it returns an error, it will return the second part of the formula, which is Error msg here in this case. Change it to whatever you want to.
Also, you can use 0 to mean FALSE in excel (and 1 to mean TRUE).
=IF(J2="", IF(ISNA(VLOOKUP(B2,Sheet1!B:F,5,FALSE)), "", VLOOKUP(B2,Sheet1!B:F,5,FALSE)),"PICKED UP")