How to find the min value for each product type

Given 2 columns (A) = Product Type (B) = Sales ($)
with multiple rows (sales amount) for each Product Type
without using a pivot table, is there a way to add a column C which contains the min Sales for that product type?
enduranceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

als315Commented:
Yes, you can, but with array formula.
If your range is A1:A6 for product type and B1:B6 for amount, use:
=MIN(IF($A$1:$A$6=A1,$B$1:$B$6,""))
press CTRL+SHIFT+ENTER
you will see:
{=MIN(IF($A$1:$A$6=A1,$B$1:$B$6,""))}
Sample-28702550.xlsx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
Here's a macro

Sub FindMinimums()
Dim lngProducts As Long
Dim lngRow As Long
Dim curMin As Currency

Application.ScreenUpdating = False

With ActiveSheet
'        .Range("A1:E" & lngLastRowE).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("U1"), Unique:=True
    .UsedRange.AutoFilter
    .Range("C1:D" & .UsedRange.Rows.Count).ClearContents
    .Range("A1:A" & .UsedRange.Rows.Count).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("C1"), Unique:=True
    .Range("C1") = "Products"
    .Range("D1") = "Min Sales"
    .Columns("A:A").Select
    For lngProducts = 2 To .Range("C1048576").End(xlUp).Row
        Selection.AutoFilter
        curMin = 999999999
        ActiveSheet.Range("A1:A" & .UsedRange.Rows.Count).AutoFilter Field:=1, Criteria1:=.Cells(lngProducts, "C")
        For lngRow = 2 To .UsedRange.Rows.Count
            If .Rows(lngRow).Hidden = False Then
                If .Cells(lngRow, "B") < curMin Then
                    curMin = .Cells(lngRow, "B")
                End If
            End If
        Next
        .Cells(lngProducts, "D") = curMin
    Next
    .UsedRange.AutoFilter
End With

Application.ScreenUpdating = True
End Sub

Open in new window

0
enduranceAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.