Count & return specific value based on multiple conditions

GingaNinga

New Member
Joined
Sep 1, 2017
Messages
26
Office Version
  1. 365
Platform
  1. Windows
Hello - first- thank you experts for your help.

I am having trouble articulating what I am trying to accomplish, but I will give it a shot.

I am trying to return a specific value in a column based on two conditions.

Condition 1: If the Unique Display ID is the same
Condition 2: If the sum of TL Gum Displays is greater than 1

Result: Unique Gum column would return a value of 1

Example of expected result:
Unique IDTL GumUnique Gum
12311
12300 or blank
12310 or blank

<tbody>
</tbody>


A few additional things - I don't care in which row the value of 1 appears for Unique Gum, and where it equals 0, I don't care if that is a 0 or a blank.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
this assumes the data is in columns A:B and results in column C. Result to be displayed on first occurence of item only.
Code:
Sub t()
Dim fn As Range, c As Range
With ActiveSheet
    .Range("A1", .Cells(Rows.Count, 1).End(xlUp)).AdvancedFilter xlFilterCopy, , .Cells(Rows.Count, 1).End(xlUp)(3), True
        For Each c In .Cells(Rows.Count, 1).End(xlUp).CurrentRegion.Offset(1)
            If Application.SumIf(.Range("A2", .Cells(Rows.Count, 2).End(xlUp)), c.Value, _
            .Range("B2", .Cells(Rows.Count, 2).End(xlUp))) >= 2 Then
                Set fn = .Range("A2", .Cells(Rows.Count, 2).End(xlUp)).Find(c.Value, , xlValues)
                    If Not fn Is Nothing Then
                        fn.Offset(, 2).Value = 1
                    End If
            End If
        Next
        .Cells(Rows.Count, 1).End(xlUp).CurrentRegion.ClearContents
End With
End Sub
 
Upvote 0
Or this formula

C2 copied down
=IF(AND(MATCH(A2,A:A,0)=ROW(A2),SUMIF(A:A,A2,B:B)>1),1,"")

M.
 
Upvote 0

Forum statistics

Threads
1,214,573
Messages
6,120,310
Members
448,955
Latest member
Dreamz high

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