Google Sheet REGEXMATCH - regex

can someone tell me what formula can represent the following statement :
If in Cell A1 there's value A or B or C or D then Value X must Show up in cell B1
If in Cell A1 there's value E or F or G or H then Value Y must Show up in cell B1
Thanks a ton!
I have tried REGEXMATCH function, but I wasn't able to mesh all the variables.

Try:
=IFS(REGEXMATCH(A1,"A|B|C|D"),"X",REGEXMATCH(A1,"E|F|G|H"),"Y",1,)

Related

In googlesheets I would like to change the value of a cell only if a condition is true otherwise keep it the same

In googlesheets I would like to change the value of a cell only if a condition is true otherwise keep it the same
=IF (a condition is true, new value , keep this cell unchanged)
An example of a formula in cell A1 might look like this
=IF( B1=1, B2, A1)
where B2 holds the new value to go in A1 if B1=1
However, if thisformula is entered in A1 then it gives an error.
try:
=IF(B1=1; B2; A1)
if this still errors out for you, circle back here with the error message

IF a a1 matches any cell in B:B then C

I have column D:D with names and column G:G has the same names but with numbers at the end so if D1 matches any cell in G for example G4 I need the data from H4. This is what I have so far
=IF(REGEXMATCH(D2,G2),H2,"")
I also tried
=IF(REGEXMATCH(D2:D,G2:G),H2:H,"")
[screenshot of sheet]
In K2 try
=ArrayFormula(if(len(D2:D), iferror(vlookup(regexreplace(D2:D, "(\s\(\d+\))",), G2:H, 2, 0)),))
and see if that works?

How do I get the count of non matching cells in a row between two sheets?

I have two sheets, Sheet A containing a truth table like such:
A B C D E
Foo T F F T F
Bar T F F F F
Sheet B contains another table:
A B C D E
T F F T F
I need to add a column to table A counting how many cells match the corresponding cell in sheet B, as such:
Foo T F F T F 2
Bar T F F F F 1
Best I could come up with for the first count cell was
=COUNTIF(B2:F2,B2:F2=INDIRECT("sheet-b!A2:E2"))
but this gives me 0 even though it should be 2.
Edit:
I was able to come up with this, which correctly counts the number of differing cells:
=SUM(ARRAYFORMULA(IF(B2:F2=INDIRECT("sheet-b!A2:E2"),1,0)))
The next thing I want is to add an AND statement, and count the cell if it matches or if the sheet-b cell is F:
=SUM(ARRAYFORMULA(IF(AND("F"=INDIRECT("sheet-b!A2:E2"),B5:F5=INDIRECT("sheet-b!A2:E2")),1,0)))
However it doesn't seem like i can use an AND statement in this formula. Even the following gives a sum of zero:
=SUM(ARRAYFORMULA(IF(AND(TRUE,B2:F2=INDIRECT("sheet-b!A2:E2")),1,0)))
how come?
Edit2: Link to example spreadsheet
how do I get the count of non-matching cells in a row between two sheets
=ARRAYFORMULA(IF(LEN(A2:A),
MMULT(IF(B2:F='sheet-b'!A2:E2, 0, 1), TRANSPOSE(COLUMN(B2:F2)^0)), ))
try:
=ARRAYFORMULA(IF(A1:A<>"", COUNTIFS(TRIM(
TRANSPOSE(QUERY(TRANSPOSE(Sheet2!J1:N),,999^99))),
TRANSPOSE(QUERY(TRANSPOSE(B1:F) ,,999^99))), ))

Excel | Get all column/row names in which a specific text is as a list

It is difficult for me to describe the problem in the title, so excuse any misleading description.
The easiest way to describe what I need is with an example. I have a table like:
A B C
1 x
2 x x
3 x x
Now what I want is the formula in a cell for every single column and row with each of the column or row name for every x that is placed. In the example like:
A B C
1,2 2,3 3
1 A x
2 A, B x x
3 B, C x x
The column and row names are not equivalent to the excel designation. It works with an easy WHEN statement for single cells (=WHEN(C3="x";C1)), but not for a bunch of them (=WHEN(C3:E3="x";C1:E1)). How should/can such a formula look like?
So I found the answer to my problem. Excel provides the normal CONCATENATE function. What is needed is something like a CONCATENATEIF (in German = verkettenwenn) function. By adding a module in VBA based on a thread from ransi from 2011 on the ms-office-forum.net the function verkettenwenn can be used. The code for the German module looks like:
Option Explicit
Public Function verkettenwenn(Bereich_Kriterium, Kriterium, Bereich_Verketten)
Dim mydic As Object
Dim L As Long
Set mydic = CreateObject("Scripting.Dictionary")
For L = 1 To Bereich_Kriterium.Count
If Bereich_Kriterium(L) = Kriterium Then
mydic(L) = Bereich_Verketten(L)
End If
Next
verkettenwenn = Join(mydic.items, ", ")
End Function
With that module in place one of the formula for the mentioned example looks like: =verkettenwenn(C3:E3;"x";$C$1:$K$1)
The English code for a CONCATENATEIF function should probably be:
Option Explicit
Public Function CONCATENATEIF(Criteria_Area, Criterion, Concate_Area)
Dim mydic As Object
Dim L As Long
Set mydic = CreateObject("Scripting.Dictionary")
For L = 1 To Criteria_Area.Count
If Criteria_Area(L) = Criterion Then
mydic(L) = Concate_Area(L)
End If
Next
CONCATENATEIF = Join(mydic.items, ", ")
End Function

3 column excel find value cell b2 in column a replace with cell c2

using 3 columns 100k down column "a:a"= part desc with part number y400cc(webpage title) cell "b1"=old part number y400cc "c1"=new part number wpy400cc.
*****Find cell b2 in column a and replace with cell c2 ?***
I am not Sure I understood your question fully. But here is my proposal:
Column A contains some text (Example: CELL A2 = "xx456yy")
Column B contains a part number which may or may not be found in A (Example CELL B2 = "456")
Column C contains the new part number (Example: CELL C2 = "900")
Column D to have the following formula, which will replace the Column B text found in Column A, with Column C text:
=IF(IFERROR(FIND(B2,A2),1)<>1,REPLACE(A2,FIND(B2,A2),LEN(B2),C2),"")