Related
I have a list of names for which I want to know if there's a cross match in family name.
So if all in Family column contain family name (as the one in col B) - there'd be a Match, otherwise not.
I started by cleaning/splitting the names
=TRANSPOSE(ARRAYFORMULA(TRIM( SPLIT(SUBSTITUTE($A2," and",","),","))))
then doing a T/F match of only the family name for each case
=ISNUMBER(MATCH(REGEXEXTRACT($B$2,"\w+$"),REGEXEXTRACT(D2,"\w+$"),0))
I wanted to do this MATCH as an array, but it's not working. And then I'd have to do a count of the TRUE value if all are TRUE return a MATCH, else NO MATCH.
I obviously want to do this in a single cell, but got stuck because I can't make the MATCH an array. I hope that makes sense, or am I going about this the wrong way.
Here's the sample sheet
try:
=ARRAYFORMULA(IF(A2:A="",,IF(1+LEN(
REGEXREPLACE(SUBSTITUTE(A2:A, "and", ","), "[^,]", ))=
MMULT(N(IFERROR(IF(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")="",,
REGEXMATCH(TRIM(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")),
REGEXEXTRACT(B2:B, "\w+$"))))),
SEQUENCE(COLUMNS(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")), 1, 1, 0)),
"match", "no match")))
use this
C2=trim(index(split(B2," "),1,COUNTA(split(B2," "))))
D2=SUBSTITUTE(A2,"and",",")
E2=if(COUNTA(split(D2,C2,false))=counta(split(D2,",",false)),"matched","not matched")
1- C2 gets the last word from sentence as last name
2- D2 Replaces "and" by ","
3- E2 splits D2 by "," and splits D2 by C2 then counts and compares if same means all matched
Result
another one for you:
=ARRAYFORMULA(
IFS(
A2:A = "",,
ISNA(MATCH(
ROW(A2:A),
QUERY(
QUERY(
SPLIT(
FLATTEN(
FILTER(
ROW(A2:A) & "♥"
& --NOT(REGEXMATCH(
SPLIT(
REGEXREPLACE(A2:A, ",\s*|\s+and\s+", "♥"),
"♥"
),
"^$|" & REGEXEXTRACT(B2:B, "\s(\w+)$")
)),
A2:A <> ""
)
),
"♥"
),
"SELECT Col1, SUM(Col2)
GROUP BY Col1",
),
"SELECT Col1
WHERE Col2 = 0",
),
)),
"NO MATCH",
True,
"MATCH"
)
)
I want to combine multiple results of if statement into a form of a sentence.
Code:
=CONCAT("Fail column", IF($T3="No", " T", "")& IF($U3="No", ", U", "") & IF($W3<7, ", W", "") & IF($X3>3, ", X", "") & IF($AE3="No", ", AE", "") & IF($AF3="No", ", AF", ""))
Sample data :
If the first statement returns blank, the next statement would not show the comma at the beginning. And let say all pass, they would be shown as "Yes".
My expected output can be:
Fail column T, U, W, X, AE, AF
Fail column U, W, X, AE, AF
Fail column T
Fail column W, X
Yes
I'm thinking you could try:
Formula in R3:
=IF(OR(T3="No",U3="No",W3<7,X3>3,AE3="No",AF3="No"),"Fail column: "&TEXTJOIN(", ",TRUE,IF(T3="No","T",""),IF(U3="No","U",""),IF(W3<7,"W",""),IF(X3>3,"X",""),IF(AE3="No","AE",""),IF(AF3="No","AF","")),"Yes")
The key here is TEXTJOIN instead of CONCAT to exclude any empty values from the concatenated string.
Note: Excel and Google Spreadsheets are two different apps and the functions are not always exchangeable. Your question's title suggests that you are actually using Excel, however your tags include GS.
correct formula would be:
=ARRAYFORMULA(REGEXREPLACE(IF(
(T3:T="yes")*(U3:U="yes")*((W3:W<7)*(W3:W<>""))*(X3:X>3)*(AE3:AE="yes")*(AF3:AF="yes"),
"yes", "Fail column: "&
IF(T3:T="no", "T, ", )&
IF(U3:U="no", "U, ", )&
iF(W3:W>=7, "W, ", )&
IF((X3:X<=3)*(X3:X<>""), "X, ", )&
IF(AE3:AE="no", "AE, ", )&
IF(AF3:AF="no", "AF, ", )), ", $|Fail column: $", ))
I have learned Crystal by trial and error, so please forgive my phrasing.
I want to combine text and fields. If there is more than one instance of Tensile.SOItemNum, then I want to repeat all instances of that field within my resultant text string and have the multiple instances be separated by commas. (Actually I would want this section to repeat for each record of Tensile.SOITEM.
The following is the formula for one text string and this would work if there were just one record.
Formula = "0003015339|01|" & totext({Tensile.SONum},0,"") & "-" &
totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} & "|" & {SOItem.CustPO} &
"|" & totext({SOItem.SOItemNum},0,"") & "|" & {SOItem.ProdCode} & "|" &
totext({ManifestLotView.Manifest},0,"") & "-" &
totext({ManifestLotView.SONum},0,"") & "-" &
totext({ManifestLotView.SOItemNum},0,"")
Which produces:
0003015339|01|114667-10-1-B-1|5400361554-R01|10|XALRET05012|27202-114667-10
If there were a 114667-10-1-B-1 and a 114668-5-2-B-1, I would want the string resultant string to read:
0003015339|01|114667-10-1-B-1,114668-5-2-B-1|5400361554-
R01|10|XALRET05012|27202-114667-10
This is some of what I was trying, but it is not a valid formula. I have not used the Next function before.
Formula = "0003015339|01|" & totext({Tensile.SONum},0,"") & "-" &
totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} & IF nextvalue
({Tensile.SONum}) > 1 then "," & totext({Tensile.SONum},0,"") & "-" &
totext({Tensile.SOItemNum},0,"") & "-" & {Tensile.Lot} end if "|" &
{SOItem.CustPO} & "|" & totext({SOItem.SOItemNum},0,"") & "|" &
{SOItem.ProdCode} & "|" & totext({ManifestLotView.Manifest},0,"") & "-" &
totext({ManifestLotView.SONum},0,"") & "-" &
totext({ManifestLotView.SOItemNum},0,"")
Thank you in advance for your time.
I have the string of the following format:
example 1: ABC,0,ABCD,ABC,ABC,ABC,ABC,ABC,11,ABC,ABC,toRemove,012,234
example 2: ABC,0,ABCD,ABC,ABC,ABC,ABC,ABC,11,ABC,ABC, toRemove,012,234
If the string contains 14 Values (instead of 13 values) separated by comma, then remove the 12. value
The second line above contains a white space, that should also removed if exists.
StringSplit has already a counter (element 0), so no need to use Ubound).
Like StringSplit converts a string to an array, ArrayToString converts an array back to a string.
#include <array.au3>
$tmp_line = "ABC,0,ABCD,ABC,ABC,ABC,ABC,ABC,11,ABC,ABC, ToRemove,012,234"
$line = StringSplit($tmp_line, ",")
If $line[0] = 14 Then
$new_line = ArrayToString($line, ",", 1, 11) & "," & ArrayToString($line, ",", 13)
Else
$new_line = $line ; shouldn't this be $new_line = $tmp_line ?
EndIf
MsgBox(0, $line[0], $tmp_line & #CRLF & $new_line)
Solved:
$line = StringSplit($tmp_line, ",")
$count_values = Ubound($line)
If $count_values = 14 Then
$new_line = $line[1] & "," & $line[2] & "," & $line[3] & "," & $line[4] & "," & $line[5] & "," & $line[6] & "," & $line[7] & "," & $line[8] & "," & $line[9] & "," & $line[10] & "," & $line[12] & "," & $line[13]
Else
$new_line = $line
EndIf
I need to get installed software in as shows in Uninstall Program in control panel. So i used Win32_RegistryAction class for querying in vb script. But still i could not query a particular key and it hangs. Here is the piece of code which i used. Please help me how to get installed software details using wmi query.
Thanks in advance
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_RegistryAction where key ='SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' and Root=2 ")
For Each objComputer in colSettings
Wscript.Echo "Display Name: " & objComputer.DisplayName
Next
You are using the wrong WMI class, you must use the StdRegProv class instead, for examples about how use this try the MSDN documentation (WMI Tasks: Registry).
Here i am answering to my own question. Thank You RRUZ for lead me in a right way. Here i have solution for this problem. Now i am able to get all installed software which are showing the uninstall program in windows. Sample code is giving here
Dim count
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames
count = 0
For i=0 To UBound(arrValueNames)
StrText = arrValueNames(i)
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "DisplayName",strName
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "DisplayVersion",strVersion
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "InstallLocation",strLocation
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "InstallDate",strDate
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "SystemComponent",strSystemComponent
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "WindowsInstaller",strWindowsInstaller
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "UninstallString",strUninstallString
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "ReleaseType",strReleaseType
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "ParentKeyName",strParentKeyName
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "Publisher",strPublisher
if isNull(strSystemComponent) then
if isNull(strWindowsInstaller) then
if not isNull(strUninstallString) then
if isNull(strReleaseType) then
if isNull(strParentKeyName) then
if not isNull(strName) then
printKeyValue "Win32_Product.PackageName[" & count & "]", StrName
printKeyValue "Win32_Product.Version[" & count & "]", StrVersion
printKeyValue "Win32_Product.InstallLocation[" & count & "]", strLocation
printKeyValue "Win32_Product.InstallDate[" & count & "]", strDate
printKeyValue "Win32_Product.Publisher[" & count & "]", strPublisher
printKeyValue "Win32_Product.WindowsInstaller[" & count & "]", strWindowsInstaller
printKeyValue "Win32_Product.UninstallString[" & count & "]", strUninstallString
printKeyValue "Win32_Product.ReleaseType[" & count & "]", strReleaseType
printKeyValue "Win32_Product.ParentKeyName[" & count & "]", strParentKeyName
count = count + 1
end if
end if
end if
end if
end if
end if
Next
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames
For i=0 To UBound(arrValueNames)
StrText = arrValueNames(i)
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "DisplayName",strName
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "DisplayVersion",strVersion
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "InstallLocation",strLocation
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "InstallDate",strDate
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "SystemComponent",strSystemComponent
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "WindowsInstaller",strWindowsInstaller
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "UninstallString",strUninstallString
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "ReleaseType",strReleaseType
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "ParentKeyName",strParentKeyName
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & arrValueNames(i), "Publisher",strPublisher
if isNull(strSystemComponent) then
if isNull(strWindowsInstaller) then
if not isNull(strUninstallString) then
if isNull(strReleaseType) then
if isNull(strParentKeyName) then
if not isNull(strName) then
printKeyValue "Win32_Product.PackageName[" & count & "]", StrName
printKeyValue "Win32_Product.Version[" & count & "]", StrVersion
printKeyValue "Win32_Product.InstallLocation[" & count & "]", strLocation
printKeyValue "Win32_Product.InstallDate[" & count & "]", strDate
printKeyValue "Win32_Product.Publisher[" & count & "]", strPublisher
printKeyValue "Win32_Product.WindowsInstaller[" & count & "]", strWindowsInstaller
printKeyValue "Win32_Product.UninstallString[" & count & "]", strUninstallString
printKeyValue "Win32_Product.ReleaseType[" & count & "]", strReleaseType
printKeyValue "Win32_Product.ParentKeyName[" & count & "]", strParentKeyName
count = count + 1
end if
end if
end if
end if
end if
end if
Next
Function printKeyValue(key, value)
Wscript.Echo key & "=>" & value
End Function
Here the path Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall is only applicable for Windows 7 or above.