Return digit that does not exist in a cell
Closed
Jean
-
May 23, 2010 at 06:44 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 25, 2010 at 04:58 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 25, 2010 at 04:58 PM
Related:
- Return digit that does not exist in a cell
- Samsung mobile reset code 8 digit - Guide
- 5 digit unlock code for tetris ✓ - Android Forum
- Wow equipment return ✓ - Network Forum
- 5 digit unlock code for ninja up - Phones, PDA & GPS Forum
- Vba create folder if not exist ✓ - Excel Forum
3 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 23, 2010 at 09:13 AM
May 23, 2010 at 09:13 AM
what would be the maximum length of values in either cells
column A will have 3-digit numbers e.g 012, column B will have 4-digit numbers e.g 2180. I would like column C to return the missing digit or in case there is no missing digit, to return the smallest digit that match the 4-digit numbers in column A.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 25, 2010 at 04:58 PM
May 25, 2010 at 04:58 PM
try this
Function myCompare(compareThis As String, compareAgainst As String) Dim StringAbsent As String Dim MaxAbsent As String Dim MinAbsent As String Dim CheckThis As String Dim iCounter As Long MaxAbsent = "" MinAbsent = "" StringAbsent = "" For ichar = 1 To Len(compareThis) CheckThis = CStr(Mid(compareThis, ichar, 1)) present = CStr(InStr(1, CStr(compareAgainst), CheckThis)) If present > 0 Then If (CheckThis > MaxAbsent) Then MaxAbsent = CheckThis If (CheckThis < MinAbsent) Then MinAbsent = CheckThis If (MinAbsent = "") Then MinAbsent = CheckThis Else StringAbsent = StringAbsent & CheckThis End If Next ichar If StringAbsent = "" Then myCompare = MinAbsent Else myCompare = StringAbsent End If End Function