TEXTJOIN Alternative

mightymo77

New Member
Joined
Dec 16, 2021
Messages
17
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hey guys. I was reading through some posts and everyone here seems very helpful. I have this formula below, however it's not working on my work machine which uses Excel 2016. Can anyone create an alternative for me that will function in Excel 2016? I would appreciate any help!

=TEXTJOIN(", ",TRUE,IF(ISNUMBER(FIND($F2:$T2,"BLACK,BLUE")),$F$1:$T$1,""))
 
Map1
FGHIJKLMNOPQRST
167890112233445566778899110
2Hi BLACK,BLUEHi BLACK,BLUEBlackbluetestthis is BLACK,BLUEthis is BLACK,BLUE
3
4
56, 7, 11, 77
Blad1
Cell Formulas
RangeFormula
F5F5=jec(F2:T2)



Not sure but still think this is what you mean

VBA Code:
Function jec(searchRng As Range) As String
 Dim it As Variant, c00 As String
 Application.Volatile
 
  For Each it In searchRng
    If InStr(it, "BLACK,BLUE") Then c00 = c00 & ", " & it.Offset(-1).Value
  Next
  jec = Mid(c00, 3)
End Function
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
But compare that to the OP's formula
+Fluff 1.xlsm
FGHIJKLMNOPQRST
167890112233445566778899110
2Hi BLACK,BLUEHi BLACK,BLUEBLUEBLACKtestthis is BLACK,BLUEBlackBluethis is BLACK,BLUE
3
4
56, 7, 11, 77
68, 9, 44, 55, 66, 88, 99, 110
Main
Cell Formulas
RangeFormula
F5F5=jec(F2:T2)
F6F6=TEXTJOIN(", ",TRUE,IF(ISNUMBER(FIND($F2:$T2,"BLACK,BLUE")),$F$1:$T$1,""))
 
Upvote 0
JEC when I enter your VBA code, then enter =jec(F2:T2) in X2, I am getting #NAME?
 
Upvote 0
Yes but I have a strong feeling that the OP's formula is not what he/she desires. The other way around is more logical, to me at least:)
 
Upvote 0
Did you right click to insert a new Module?
 
Upvote 0
@mightymo77 Looking at post#12 which cell is giving the expected result F5, F6 or neither?
 
Upvote 0
I don't know. Let me try to explain it differently. Here is my csv's columns A - W:


First NameLast NameUser EmailDevice NameRiskFirewallPeer to PeerAntivirusEncryptionWiFiPasscodePassword PolicyAntispywareOS Auto UpdateDisk EncryptionCompany NameDate EnrolledLast ConnectedAutolockOS Up-to-DateOS NameOS ArchitectureOS Version
BRITTCLINEBRITT.CLINE@email.comBRITT-T550(9664)
800​
PASSPASSPASSNAPASSNAPASSWARNINGPASSPASSAcme11.02.2021 14:25 GMT12.15.2021 10:26 GMTNANAWindows 10 Pro
64​
10.0.19043
JANSMITHJAN.SMITH@email.comJANiPhone.local(9665)
800​
NANANAPASSWARNINGPASSNANANANAAcme11.02.2021 14:37 GMT12.03.2021 20:43 GMTWARNINGPASSiOSx6415.1.1
JANETLACYjanet.LACY@email.comT550(9666)
800​
PASSPASSPASSNAPASSNAPASSWARNINGPASSFAILAcme11.03.2021 17:41 GMT12.15.2021 01:23 GMTNANAWindows 10 Pro
64​
10.0.19043

What I am needing are the names of the FAIL and WARNING titles to be displayed in column X. For example X2 should read Antispyware, X3 should read WiFi, Autolock and X4 should read Antispyware, Disk Encryption.

Sorry if there was any confusion. Does this make more sense? I cannot use the TEXTJOIN unfortunately because I am using Excel 2016 on my work machine.
 
Upvote 0
Then like this

VBA Code:
Function jec(searchRng As Range, mergeRng As Range) As String
 Dim it As Variant, ar As Variant, i As Long, c00 As String
 Application.Volatile
 
 ar = searchRng
 For i = 1 To UBound(ar, 2)
    If ar(1, i) = "WARNING" Or ar(1, i) = "FAIL" Then c00 = c00 & ", " & mergeRng(1, i)
 Next
 jec = Mid(c00, 3)
End Function


Excel Formula:
=jec(F2:T2;$F$1:$T$1)
 
Upvote 0
You can remove Dim it as variant, I forgot
 
Upvote 0
JEC I opened the VBA window, created a second module window, and pasted this in:

Function jec(searchRng As Range, mergeRng As Range) As String
ar As Variant, i As Long, c00 As String
Application.Volatile

ar = searchRng
For i = 1 To UBound(ar, 2)
If ar(1, i) = "WARNING" Or ar(1, i) = "FAIL" Then c00 = c00 & ", " & mergeRng(1, i)
Next
jec = Mid(c00, 3)
End Function


I then closed those two windows to bring me back to the csv file, and pasted this in X2:
=jec(F2:T2;$F$1:$T$1)

I am getting "There's a problem with this formula" error. Am I doing something wrong?
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,783
Members
449,188
Latest member
Hoffk036

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top