Current UDF - Compare two text strings make not case senstive

alex0182828

Board Regular
Joined
Jun 20, 2012
Messages
88
Office Version
  1. 365
Platform
  1. MacOS
I use these two UDFS to find the differences between two strings of text, i would be great if they were case insensitive.

If anyone knows how to change these ones or has a better UDF for comparing two text strings ( like with options for choosing different / multiple
seperators etc that would be great ).

Function GetDiffs1(Cell1 As Range, Cell2 As Range) As String
Dim Array1, Array2, lLoop As Long Dim strDiff As String, strDiffs As String Dim lCheck As Long Array1 = Split(Replace(Cell1, " ", ""), ",") Array2 = Split(Replace(Cell2, " ", ""), ",") On Error Resume Next With WorksheetFunction For lLoop = 0 To UBound(Array1) strDiff = vbNullString strDiff = .Index(Array2, 1, .Match(Array1(lLoop), Array2, 0)) If strDiff = vbNullString Then lCheck = 0 lCheck = .Match(Array1(lLoop), Array2, 0) If lCheck = 0 Then strDiffs = strDiffs & "," & Array1(lLoop) End If End If Next lLoop End With GetDiffs1 = Trim(Right(strDiffs, Len(strDiffs) - 1)) End Function

Function GetDiffs2(Cell1 As Range, Cell2 As Range) As String
Dim Array1, Array2, lLoop As Long Dim strDiff As String, strDiffs As String Dim lCheck As Long Array1 = Split(Replace(Cell1, " ", ""), ",") Array2 = Split(Replace(Cell2, " ", ""), ",") On Error Resume Next With WorksheetFunction For lLoop = 0 To UBound(Array2) strDiff = vbNullString strDiff = .Index(Array1, 1, .Match(Array2(lLoop), Array1, 0)) If strDiff = vbNullString Then lCheck = 0 lCheck = .Match(Array2(lLoop), Array1, 0) If lCheck = 0 Then strDiffs = strDiffs & "," & Array2(lLoop) End If End If Next lLoop End With GetDiffs2 = Trim(Right(strDiffs, Len(strDiffs) - 1)) End Function</pre>
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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