If function - equal/different/blank - if-statement

I'm trying to write an formula that will give me the following result:
IF H1=H2, write "OK", if they are different, write "NO", if H1 is blank, then become blank too.
I tried like this:
=IF(H1=H2;"OK";"NO";IF(H1="";""))
And it says I've entered too many arguments for this function.
Any advice?

You added an extra ;, try this:
=IF(H1="";"";IF(H1=H2;"OK;"NO"))

Solved like this
=IF(H1="","",IF(H1=H2,"OK","NO"))
Thankyou everyone

Related

Modx *id isnot =`` and isnot=`` not working

Hi can someone help me with the correct code for this statement because it is not working for me.
[[*id:isnot=`250` and isnot=`252`:then=`[[$qc-wrap]]`]]
A more performant syntax would be:
[[[[*id:isnot=`250`:or:isnot=`252`:then=`$qc-wrap`:else=``]]]]
Note: updated to reflect comment below. Include a hyphen in the else value, as this:
[[[[ ... :else=`-`]]]]
Also note: an empty else condition can be left off entirely.
I think using or rather than and is appropriate here.
This article is great for understanding MODX conditionals:
https://sepiariver.com/modx/modx-output-filters-if-phx-conditional-statements-tutorial/
And this one for understanding the syntax above and why it's more performant:
https://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
You use wrong syntax, please fix as follows:
[[*id:isnot='250':and:isnot='252':then='[[$qc-wrap]]']]
Don't forget to replace ' with ` within this example
A simpler solution for this question is to use the :inarray output modifier to return an empty string, and use the :default output modifier to customize output for everything that doesn't match 250 or 252:
[[*id:inarray=`250,252`:then=``:default=`[[$qc-wrap]]`]]

TO_PURE_TEXT with cell referencing doesn't filter double quotes against documentation

I want to get a clean number from a string like "123.45". On using of =TO_PURE_TEXT(C10) it doesn't work for me,
against an example from the documentation. An absolute referencing doesn't help.
But, if i use no cell referencing, but direct input, like =TO_PURE_TEXT("123.45") the input is correct, as expected without quotes.
Is it a kind of bug, or do i really do something wrong? How can i get this work with the cell referencing?
all you need is:
=SUBSTITUTE(C10, """", )*1
or:
=REGEXREPLACE(C10, """", )*1
I can't speak to whether it's a bug. Does seem odd, but this should work for now:
=1*SUBSTITUTE(C10,CHAR(34),"")

Extracting part of a string in Google Sheets

I'm trying to extract the classname from a list of UE4 blueprint paths that look like this:
"Blueprint'/Game/Aberration/CoreBlueprints/Weapons/PrimalItemAmmo_Zipline.PrimalItemAmmo_Zipline'"
The end result needs to be something like this:
PrimalItemAmmo_Zipline_C
I guess the easiest way would be to extract everything between the "." and the apostrophe at the end, before appending the _C. I've tried a few different solutions I've found online, mostly modified from formulas for getting filenames from filepaths, but I can't get any of them to work properly.
What would be the best way to do this?
Assuming the string in A1, try
=substitute(regexextract(A1, "[^.]*$"), char(39)&char(34), "_C")
and see if that works?
try:
=REGEXEXTRACT(A1, "\.(.*)'")&"_C"
for array do:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A, "\.(.*)'")&"_C"))

Regex to eliminate a word

I have strings like
BadRequestException("hello world")
BadRequestException(BadRequestException::$errors->message)
ConflictException(ConflictException::$errors->sldkf)
ConflictException("skdljf")
How do i add a regex that gets me these two:
ConflictException("skdljf")
BadRequestException("hello world")
I tried /Exception(/ to retrieve everything.
I could not figure out a way to eliminate those strings that contain "$errors"
I tried this:
/Exception(?!errors)/
But it did not work as per my requirements.
Thanks
Figured it out.
I used
Exception(?!.*::\$errors)

How to use the matched text in the replacement text in Vim

I have a block of codes with timestamp in front of each line like this:
12/02/2010 12:20:12 function myFun()
12/02/2010 12:20:13 {....
The first column is a date time value. I would like to comment them out by using Vim, thus:
/*12/02/2010 12:20:12*/ function myFun()
/*12/02/2010 12:20:13*/ {....
I tried to search for date first:
/\d\d\/\d\d\/\d\d\d\d \d\d:\d\d:\d\d
I got all the timestamps marked correctly. However When I tried to replace them by the command:
%s/\d\d\/\d\d\/\d\d\d\d \d\d:\d\d:\d\d/\/*\d\d\/\d\d\/\d\d\d\d \d\d:\d\d:\d\d*\//
I got the following result:
/*dd/dd/dddd dd:dd:dd*/ function myFun()
/*dd/dd/dddd dd:dd:dd*/ {....
I think I need to name the search part and put them back in the replace part. How I can do it?
I suppose I would just do something like:
:%s-^../../.... ..:..:..-/* & */-
I would actually not us a regex to do this. It takes too long to enter the correct formatting. I would instead use a Visual Block. The sequence works out to be something like this.
<C-V>}I/* <ESC>
3f\s
<C-V>I */
I love regex, and don't want to knock the regex solutions, but find when doing things with pre-formatted blocks, that this is easier, and requires less of a diversion from the real task, which isn't figuring out how to write a regex.
%s/\d\d\/\d\d\/\d\d\d\d \d\d:\d\d:\d\d/\/*&*\//
:%s/^\([0-9/]* [0-9:]* \)\(.*\)/\/*\1*\/ \2/