Need clarity with IFS function in Google Sheets with multi criteria - if-statement

I'm trying to keep the numbers in "Inv.No." till 3-digits only having condition that either of the two specific cells are not empty. I am unable to do that after No.10. Below are few of the codes that I've tried with IFS function. Please note that the all cells have been kept to be "Numerical", the first is [(E5) = "00"&1 ]
Codes:
=ifs(OR(I15="",E14=""),"",if(OR(E14>1,E14<9),"00"&(E14+1),"0"&(E14+1)))
=ifs(OR(I11="",E10=""),"",OR(E10>1,E10<9),"00"&(E10+1))
Image of the current ouput

Try using Text instead of the If statement:
=if(E5="","",text(E5,"000"))
Or as an array formula:
=ArrayFormula(if(E5:E="","",text(E5:E,"000")))

Related

spliting based on a condition and Array arguments to IF are of different size

I'm working on a sheet that can be extracted from a system and all the data is in one cell so i need to split them and it is basic for all cells except for resutls. as you can see test results should follow the same pattren of result status. so i regularlly splited one column (test status) and i tried to split test results based on if condition
it worked perfectly, however, for some status test results were not spliting because (Array arguments to IF are of different size.)
how do i fix this, please help
Thank you
Because IF() function is checking only first cell of C2:G2 range. Concat them into a single string them use search function to detect word Final. Try-
=IF(ISNUMBER(SEARCH("Final",JOIN(",",C2:G2))),SPLIT(H2,","),"")
You may try this:
=BYCOL(C2:G2,LAMBDA(Σ,(IF(Σ<>"Final",,INDEX(SPLIT(H2,","),, COUNTIF(C2:Σ,Σ))))))

How can I extract specific patterns from a string?

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; ","))))

Regexmatch for multiple words in Sheets

I'm trying to write a REGEXMATCH formula for Sheets that will analyze all of the text in a cell and then write a given keyword into another cell.
I've figured out how to do this for a single keyword: for example,
=IF(REGEXMATCH(F3, "czech"),"CZ",IF(REGEXMATCH(F3, "african"),"AF",IF(REGEXMATCH(F3, "mykonos"),"MK")))
What I'm having trouble with though is writing one of these values only if two or more terms are matched in the reference cell.
If I were trying to match one of two words, I realize I could use | as in:
=IF(REGEXMATCH(F3, "czech|coin"),"CZC"
etc
But in this instance I only want to produce CZC if the previous cell contains BOTH czech AND coin.
Can someone help me with this?
try like this:
=IF((REGEXMATCH(F3, "czech"))*(REGEXMATCH(F3, "coin")), "CZC", )
multiplication stands for AND

Google Sheets: Multiple "if" and "find" within an Array formula

background info - not important
I realise I need improvement on understanding logic and understanding documentation when playing around with Android apps. So, I thought I'll switch to Google Sheets in the hope of some basic practice in a context I might find easier to understand.
question
I've set up a Google Sheet:
https://docs.google.com/spreadsheets/d/1T7q_CGMFObxS_0DGikUdSdLTf97XmEPXY0S7yItuA5Y/edit?usp=sharing
I would like Column B to:
display "Folder1" if "Black" is found in the adjacent Column A cell.
display "Folder2" if "Blue" is found in the adjacent Column A cell.
display "Folder3" if "Green" is found in the adjacent Column A cell.
and to then be able to add more conditions.
My formula for Column B is currently:
=ARRAYFORMULA(
IFS(
find("Black", A2:A,1)>0,"Folder1",
find("Blue", A2:A,1)>0,"Folder2",
find("Green", A2:A,1)>0,"Folder3")
)
Which is only meeting the first condition "Folder1" if "Black" is found and not continuing with the rest of the if clauses.
I think I have nested it correctly though because all of the IFS() are at the same level with their corresponding find() within. And, I have two closing brackets which close the IFS and the ARRAYFORMULA.
Am I just simply not using the right kind of functions for what I'd like to do?
Thank you for your suggestions on how I can solve this!
The problem is that find() only returns a number > 0 if it actually finds a match. Otherwise it returns an error which you can't test for explicitly.
You can fix you code like this:
=ARRAYFORMULA(
IFS(
isnumber(find("Black", A2:A,1)),"Folder1",
isnumber(find("Blue", A2:A,1)),"Folder2",
isnumber(find("Green", A2:A,1)),"Folder3")
)
Now we can test that what find() returns is an number and the code will work!
Obviously, I put on multiple lines for clarity.

Conditional Vlook up without using VBA

I want to convert an input to desired output. Kindly help.
In the output - the columns value should start from most recent (year)
Please click this to see data
Unfortunately VLOOKUP is not able to fulfill that ask. However the INDEX-function can.
Here is a good read on how to use it:
http://fiveminutelessons.com/learn-microsoft-excel/use-index-lookup-multiple-values-list
This will work for you spreedsheet, if your input table starts at A1 without a header and your output table starts at H3 with the first ID.
You get this by copy&pasting the first column of your input table to column H and then remove duplicates.
{=IF(ISERROR(INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3)),"",
INDEX($A$1:$C$7;SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))}
Let's look at the formula step by step:
The curly brackets tell excel that this is an array formula, the interesting part for you is: when you've inserted the formula (without curly brackets) press shift+ctrl+enter, excel will then know that this is an array formula.
'error at formula?, then blank, else formula
=IF(ISERROR(....),"",...)
When you autofill this formula you probably dont know how many instances of your lookup variable are. So when you put this formula in 4 cells, but there are only 3 entries, this bit will keep the cell blank instead of giving an error.
INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))
$A$1:$C$7 is your data matrix. Your IDs (in your case 125 and 501) are to be found in $A$1:$A$7. ROW(1:1) is the absolute(!) rowID, 3 the absolute(!) column id. So when you move your input table those values have to be changed.
What exactly SMALL and INDEX do are well described in the link above. (Or at least better than I could.)
Hope that clarified some parts,
Tom