I need help with a formula that will return true only when
( category <> "red" )
OR
( category = "red" AND EmployeeName is not empty )
Thanks very much !
=IF(category <> "red",TRUE,if(EmployeeName<>""))
or
=IF(category <> "red",TRUE,not(isblank(EmployeeName)))
ALSO, since the result ill be FALSE ONLY when EmployeeName is null and category is red you could just do:
=NOT(AND(EmployeeName="",category="red"))
Related
I am looking for particular text in a column in data, if the text exists, I want to return True if not false.
This is the code I have:
Test = if(containsstring(DS[Name]=".SA"),"T","F")
I have tried it with wildcards and no wild cards.
Any help would be appreciated
Replace your = with a comma ,.
Test = IF ( CONTAINSSTRING ( DS[Name], ".SA" ), "T", "F" )
I have some doubts, i want to replace the values in column for the values of the other one, i have my query like this
= Table.ReplaceValue(#"Renamed Columns1", each ["Alcance-Canal"], null , Replacer.ReplaceValue,{"CANAL/ES"})
however it still doesn't work, could you please assist me?
Regards
Easiest thing to do is add a custom column with formula
= if [columnname] = "something" then [columnname] else [othercolumnname]
or
= if [columnname] = "something" then "anotherthing" else [othercolumnname]
I'm trying to search a string for a set of values and return the value ONLY if the string matches exactly with one of the set.
My original expression was as so:
title = "MrS"
setTitles = {"Miss", "Mr", "Mrs", "Dr", "Ms"}
title = (title:gsub("%w",string.lower)):gsub("^l", string.upper)
if string.match(title, setTitles) ~= nil then title = title else title = "XX" end
I then realised I needed some way of cycling through the values so got to here:
title = "MrS"
setTitles = {"Miss", "Mr", "Mrs", "Dr", "Ms"}
title = (title:gsub("%w",string.lower)):gsub("^%l", string.upper)
for i = 1, 5 do
if string.match(title, setTitles[i]) ~= nil
then title = title
else title = "XX"
end
end
Except that just returns "XX" every time.
I know it's probably quite simple and obvious, but I can't seem to find a solution and would really appreciate a hand!
Here is why your code is not working. Your first iteration of the loop uses Mrs and checks if it matches Miss, and it does not so it changes title to XX and thus no following checks can ever match.
You cant change title until you have checked all your possible values first.
By adjusting your code to use a matchFound variable to determine if the change is needed you can fix this problem:
local matchFound = false
for i = 1, 5 do
if string.match(title, setTitles[i]) ~= nil then
matchFound = true
break
end
end
if matchFound == false then
title = "XX"
end
print(title)
Additionally your code can give false matches for Mr rather then Mrs this is because Mr will match inside Mrs or any string that starts with Mr. To change this you can adjust your call of string.match to:
string.match(title, "^".. setTitles[i] .. "$")
This forces string.match to insure that the first and last chars of the pattern are also the first and last chars of the string passed to it.
As a suggestion, Rather then using string.match, make your setTitles a proper set like:
local setTitles = {["Miss"] = true, ["Mr"] = true, ["Mrs"] = true, ["Dr"] = true, ["Ms"] = true}
Then your check becomes:
title = setTitles[title] and title or "XX"
Lua resource on Sets:
https://www.lua.org/pil/11.5.html
http://lua-users.org/wiki/SetOperations
You shouldn't change the title variable in the for loop.
You can try this code:
--title = "MrS"
title = "MrX"
setTitles = {"Miss", "Mr", "Mrs", "Dr", "Ms"}
title = title:gsub("%w", string.lower) -- mrs
title = title:gsub("^%l", string.upper) -- Mrs
ismatch = false
for i = 1, 5 do
print(title, setTitles[i])
if tostring(title) == tostring(setTitles[i]) then
ismatch = true
print("matched")
return
end
end
if ismatch then title = title else title = "XX" end
print(title)
Hope this helps.
if {spFMGenerateSubReportB;1.BendNo} > 0 then
(totext({spFMGenerateSubReportB;1.SheetTotal} * {spFMGenerateSubReportB;1.BendNo}, 0) )
else
""
When i saved this formula in crystal report. It says a string is required here.
Does anyone know how to solve it
I would suspect either {spFMGenerateSubReportB;1.SheetTotal} or {spFMGenerateSubReportB;1.BendNo} are non-numeric fields. Probably contains a alpha or punctuation mark somewhere in the field. This formula should help you vet that out if it is the case
if isnumeric({spFMGenerateSubReportB;1.SheetTotal}) and isnumeric({spFMGenerateSubReportB;1.BendNo}) then
if tonumber({spFMGenerateSubReportB;1.SheetTotal})>0 then
(totext(tonumber({spFMGenerateSubReportB;1.SheetTotal})*tonumber({spFMGenerateSubReportB;1.BendNo}),0) )
else ""
else "NonNumeric"
Basically, I want to indicate "TRUE" in K2 when all the cells in E2:J2 are "YES", not "NO" and ignoring blanks.
I'm not sure if I am in the right place, but I've been on this site before to look for answers.
https://docs.google.com/spreadsheets/d/14U1LpZ-C0vqNLFh6BwOdgYMCKfqIJpmH_AhrC1m4114/edit?usp=sharing
So in E2:J2, it should come out as "FALSE" because there is a "NO"
In E3:J3, it should come out as "TRUE" because they are all "YES" and the blanks are ignored
In E4:J4, it should come out as "FALSE" because all of the blanks were ignored.
The closest I came was =IF(COUNTIFS(E2:J2,">""",E2:J2,"NO")=0,,(COUNTIFS(E2:J2,">""",E2:J2,"NO")))
The problem with that function is that set it so that all blanks were treated as zero. So in the table below, K would have read "TRUE" if they were all blanks.
I'm not exactly proficient at this and everything I've done to this point has been self-taught through Googling what other people have done. I'm sure there is a simple way and I am making this way more complex than necessary. But I can't figure it out.
Any help would be greatly appreciated!
Not the most attractive formula but it works.
=IF(OR(E2 <> "",F2 <> "",G2 <> "",H2 <> "",I2 <> "",J2 <> ""),IF(AND(OR(E2 = "Yes",E2 = ""),OR(F2 = "Yes",F2 = ""),OR(G2 = "Yes",G2 = ""),OR(H2 = "Yes",H2 = ""),OR(I2 = "Yes",I2 = ""),OR(J2 = "Yes",J2 = "")),"TRUE","FALSE"),"FALSE")
EDIT - A much better formula suggested by someone on the product forms.
=ISODD((COUNTIF(E2:J2,"YES")>0)*(COUNTIF(E2:J2,"NO")=0))