Identify presence of difference texts across DIFFERENT cells, per group

Corp_exceller

New Member
Joined
Aug 7, 2022
Messages
19
Office Version
  1. 2013
Platform
  1. Windows
I have the below data and want to see how I can achieve the last column.

Basically wanting to check for text down a column and per code so for example, I'm not looking for cells that contain "A" and "B" in the one cell, I'm looking for "A" and "B" across cells i.e. groups of codes, so that I can identify whether e.g. Code 1 has gone from A to B (presence of A and B in levels), or whether it's just stayed at A (presence of just A in levels), or whether the code has skipped level A and gone to B (presence of only Bs in level).

Apologies if I've been unclear.
CodeLevelProgression
1AA TO B
1AA TO B
1AA TO B
1AA TO B
1BA TO B
2BB ONLY
2BB ONLY
3AA ONLY
4AA TO B
4BA TO B
4BA TO B
5AA ONLY
5AA ONLY
 

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.
Try:
VBA Code:
Sub IdentifyDiff()
    Application.ScreenUpdating = False
    Dim i As Long, v As Variant, val As String, x As Long, cnt As Long
    v = Range("A2", Range("A" & Rows.Count).End(xlUp)).Resize(, 2).Value
    With CreateObject("Scripting.Dictionary")
        For i = 1 To UBound(v, 1)
            If Not .Exists(v(i, 1)) Then
                val = v(i, 1) & "|" & v(i, 2)
                .Add v(i, 1), Nothing
                x = i + 1
                cnt = 1
            Else
                If v(i, 1) & "|" & v(i, 2) <> val Then
                    Range("C" & x & ":C" & i + 1) = Split(val, "|")(1) & " to " & v(i, 2)
                Else
                    Range("C" & x & ":C" & i + 1) = Split(val, "|")(1) & " ONLY"
                End If
            End If
            If cnt = 1 Then Range("C" & x & ":C" & i + 1) = Split(val, "|")(1) & " ONLY"
            cnt = 0
        Next i
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for the response. I’m back to work tomorrow so will check this VBA out and let you know how I get on!
 
Upvote 0
Upvote 0
Upvote 0
Solution
Thanks Peter, that seems to have cracked it. I only have one other question which could change things. I'm now wanting this on google sheets which does not allow the aggregate function. Do you know of an alternative? I've tried filter but seems to have issues with the number of columns v rows.

@mumps Thanks very much for your response as it does work for me. A formula is more what I'm after so have gone with the formula response as being solution. Nevertheless, thank you for your correct answer!
 
Upvote 0
I'm now wanting this on google sheets which does not allow the aggregate function. Do you know of an alternative?
I don't answer Google Sheets questions. I suggest that you start a new thread in the General Discussion & Other Applications forum which is the correct forum for Google Sheets questions. In that thread you could put a link back to this one for reference.
 
Upvote 0
Anyone have a Google sheets solution for this? AGGREGATE function doesn’t exist on Google sheets. See new thread below.

 
Upvote 0
@Peter_SSs would it be possible to explain how that formula works? If I can understand it, I can maybe replicate win Google sheets. No probs if it’s overly complicated though!
 
Upvote 0
Here is a version that does not use AGGREGATE. Perhaps you can adapt that? This is an array formula so you need to confirm it with Ctrl+Shift+Enter, not just Enter.

22 09 01.xlsm
ABC
1CodeLevelProgression
21AA TO B
31AA TO B
41AA TO B
51AA TO B
61BA TO B
72BB ONLY
82BB ONLY
93AA ONLY
104AA TO B
114BA TO B
124BA TO B
135AA ONLY
145AA ONLY
Progression (3)
Cell Formulas
RangeFormula
C2:C14C2=IF(A2=A1,C1,SUBSTITUTE(B2&" TO "&INDEX(B:B,LARGE(IF(A2:A$100=A2,ROW(B2:B$100)),1)),"TO "&B2,"ONLY"))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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