Need to determine all rows with common ID value that don't contain a specific string value

jameskbw

New Member
Joined
Feb 8, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I have data that represent a child parent relationship from Salesforce - account and contact. Every row contains an account id which would be the value to "group by."

Each row contains several contact specific fields, and also the account id. The goal is to find all accounts (or at the account level) where none of the contacts contain the string "Statement Delivery" in the Contact Role field / column. E.G. if there are 20 contacts that all have the same account id value, and none of them contain "Statement Delivery" in the contact role column, I want to flag or tag that account some how.

This is a multi select picklist field so strings are separated by ;

I'm not even sure where to start, but hoping someone can point me in the right direction. Any help would be greatly appreciated.
2023-02-08 11_28_05-Contacts and Accounts contact role-2023-02-07-15-12-18.xlsx - Excel.png
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
It is hard to work with a picture. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). Also, explain what you want to do when you find them.
 
Upvote 0
A mini sample (anonmized) using the xl2bb add in would be helpful.
But does the autofilter work for partial text string searches:

I hope this works:

Mr Excel Questions2.xlsm
IJ
2Col1Col2
3YJOHKE
4ADQDLH
5OLTSEL
6VKVORL
7BUEIXN
8NVIGEE
9JODNGD
10TAPPTE
11XLGUFF
12VZCADV
13
14Filter Rule: Does Not Contain "V"
15Col1Col2
16YJOHKE
17ADQDLH
18OLTSEL
20BUEIXN
22JODNGD
23TAPPTE
24XLGUFF
CondFmt HiLite Cells within Rng




1675874553244.png
 
Upvote 0
Sure, I will work on anonymizing the data, uploading a mini-sheet, and clarifying what I need.
 
Upvote 0
Sure, I will work on anonymizing the data, uploading a mini-sheet, and clarifying what I need.
You only need a few rows
But, have you tried the filter? Or Have I missed something different you needed?
 
Upvote 0
Okay, let me know if this pastes correctly:

Contacts and Accounts contact role-2023-02-07-15-12-18.xlsx
ABC
1Contact IDContact RoleAccount ID
2003DJ00000dVZxNYAWBilling; Statement Delivery; Technical; Non-Operational; Operations0014y01102ZsOcA
3003DJ00000dVZxOYAWNon-Operational; International Compliance0014y02202RDeA7
4003DJ00000dVZxPYAWNon-Operational0014y02202RDeA7
5003DJ00000dVZxQYAWNon-Operational0014y02202RDeA7
6003DJ00000dVZxRYAWNon-Operational0014y02202RDeA7
7003DJ00000dVZxSYAWNon-Operational0014y02202RDeA7
8003DJ00000dVZxTYAWNon-Operational0014y02202RDeA7
9003DJ00000dVZxUYAWNon-Operational0014y02202RDeA7
10003DJ00000dVZxVYAWNon-Operational0014y02202RDeA7
11003DJ00000dVZxWYAWNon-Operational0014y02202RDeA7
12003DJ00000dVZxXYAWNon-Operational0014y02202RDeA7
13003DJ00000dVZxYYAWNon-Operational0014y02202RDeA7
14003DJ00000dVZxZYAWNon-Operational0014y02202RDeA7
15003DJ00000dVZxaYAGNon-Operational0014y02202RDeA7
16003DJ00000dVZxbYAGNon-Operational0014y02202RDeA7
17003DJ00000dVZxcYAGNon-Operational0014y02202RDeA7
18003DJ00000dVZxdYAGNon-Operational0014y02202RDeA7
19003DJ00000dVZxeYAGNon-Operational0014y02202RDeA7
20003DJ00000dVZxfYAGNon-Operational0014y02202RDeA7
21003DJ00000dVZxgYAGNon-Operational0014y02202RDeA7
22003DJ00000dVZxhYAGNon-Operational0014y02202RDeA7
23003DJ00000dVZxiYAGNon-Operational; International Compliance0014y02202RDeA7
24003DJ00000dVZxjYAGNon-Operational0014y02202RDeA7
25003DJ00000dVZxkYAGNon-Operational0014y02202RDeA7
26003DJ00000dVZxlYAGBilling0014y02202RDeA7
27003DJ00000dVZxmYAGNon-Operational0014y02202RDeA7
28003DJ00000dVZxnYAGBilling; Statement Delivery0016001100omi13
29003DJ00000dVZxoYAGNon-Operational0016001100omi13
30003DJ00000dVZxpYAGNon-Operational0016001100omi13
31003DJ00000dVZxqYAGNon-Operational0016001100omi13
32003DJ00000dVZxrYAGNon-Operational0016001100omi13
33003DJ00000dVZxsYAGNon-Operational0016001100omi13
34003DJ00000dVZxtYAGNon-Operational0016001100omi13
35003DJ00000dVZxuYAGNon-Operational0016001100omi13
36003DJ00000dVZxvYAGNon-Operational0014y01102RDeDR
37003DJ00000dVZxwYAGNon-Operational0014y01102RDeDR
38003DJ00000dVZxxYAGNon-Operational0014y02202RDeDS
39003DJ00000dVZxyYAGNon-Operational0014y02202RDeDS
40003DJ00000dVZxzYAGNon-Operational0014y02202RDeDS
41003DJ00000dVZy0YAGNon-Operational0014y02202RDeDS
Sheet1


What I'm trying to do is treat all contact id's with the same account id as one group. Within that group, look at contact role (columb B). Within the same account id (column C) if no contact has string "Statement Delivery" in column B, flag that in a new column. I'm not sure the best way to do that, but true, false, 1, 0 would be fine. I just need an easy way to look at the spreadsheet and show all the account id's that don't have any statement delivery value for all rows with the same account id.

Let me know if that makes sense, happy to clarify or provide more info.
 
Upvote 0
Use the date filter. Select all of your data. From Ribbon, select Data, then click the Filter Icon (looks a little like a funnel).
THen little arrows will appear.
Then select the column you want to filter on. You'll get these dialogs:
1675879137284.png






1675879124255.png
 
Upvote 0
That will give you all the records without Statement Delivery. To then filter for a specific subset, filter another column, Account ID for example.
 
Upvote 0
Try:
VBA Code:
Sub FlagRows()
    Application.ScreenUpdating = False
    Dim v As Variant, i As Long, fnd As Range
    v = Range("C2", Range("C" & Rows.Count).End(xlUp)).Value
    With CreateObject("scripting.dictionary")
        For i = LBound(v) To UBound(v)
            If Not .exists(v(i, 1)) Then
                .Add v(i, 1), Nothing
                With ActiveSheet
                    .Range("A1").CurrentRegion.AutoFilter 3, v(i, 1)
                    Set fnd = .AutoFilter.Range.Offset(1).Columns(2).Find("Statement Delivery", LookIn:=xlValues, lookat:=xlPart)
                    If Not fnd Is Nothing Then
                        .AutoFilter.Range.Offset(1).Columns(3).Interior.ColorIndex = 3
                    End If
                End With
            End If
        Next i
    End With
    Range("A1").AutoFilter
    Rows(Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1).Delete
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Here it is with two filters (the 'does not contain = 'Statement Delivery' and for a selected Account ID)
Mr Excel Questions2.xlsm
GHIJK
1Contact IDContact RoleAccount ID
36003DJ00000dVZxvYAGNon-Operational0014y01102RDeDR
37003DJ00000dVZxwYAGNon-Operational0014y01102RDeDR
42
Does Not Contain Filter
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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