help with a min formula

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
528
Office Version
  1. 365
Platform
  1. Windows
hi

i have this formula below
Excel Formula:
=IF(A2="","",IF((COUNTIFS($A2:A$686,A2)=2)+0=0,FMin(E2:K2),""))

i would like to add one more thing to this, that if its a duplicate it should only show me the fmin of the lowest of the two or three duplicates

the fmin is a custom function the code is below

VBA Code:
Function fMin(r As Range)
Dim cel As Range

For Each cel In r
    If InStr(cel.NumberFormat, "$") > 0 Then
        If IsEmpty(fMin) And cel.Value > 0 Then fMin = cel.Value
        If cel.Value < fMin And cel.Value > 0 Then fMin = cel.Value
    End If
Next cel

End Function

example attached

Book2
ABCDEFGHIJ
1Item #DescriptionPriceqtyPriceqtyPriceqtyPriceresults
200001orange$42.0010$38.2020$37.2030$33.00
300002apple$42.0010$38.2020$37.2030$33.00
400003banana $42.0010$38.2020$37.2030$33.00
5
600001orange$42.0010$38.2020$37.2030$32.00$32.00
700002apple$42.0010$38.2020$37.2030$32.00$32.00
800003banana $42.0010$38.2020$37.2030$32.00$32.00
9
1000001orange$42.0010$38.2020$37.2030$43.00
1100002apple$42.0010$38.2020$37.2030$43.00
1200003banana $42.0010$38.2020$37.2030$43.00
Sheet1



Thanks
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
How about:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
21orange4210$ 38.2020$ 37.2030$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 43.00
112apple4210$ 38.2020$ 37.2030$ 43.00
123banana 4210$ 38.2020$ 37.2030$ 43.00
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER(E2:I100,A2:A100=A2),{1,0,1,0,1}),IF(AND(ROWS(f)>1,A2<>"",MIN(E2,G2,I2)=MIN(f)),MIN(f),""))


You don't need the fMin function,
 
Upvote 0
How about:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
21orange4210$ 38.2020$ 37.2030$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 43.00
112apple4210$ 38.2020$ 37.2030$ 43.00
123banana 4210$ 38.2020$ 37.2030$ 43.00
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER(E2:I100,A2:A100=A2),{1,0,1,0,1}),IF(AND(ROWS(f)>1,A2<>"",MIN(E2,G2,I2)=MIN(f)),MIN(f),""))


You don't need the fMin function,
Hi
it seems to only work if there is a duplicate but if the items is not duplicated it returns blank i want it to return the min like fmin
 
Upvote 0
OK, how about:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
24Peach4210$ 38.2020$ 37.2030$ 33.00$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 43.00
112apple4210$ 38.2020$ 37.2030$ 43.00
125kiwi4210$ 38.2020$ 37.2030$ 43.00$ 37.20
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER($E$2:$I$100,$A$2:$A$100=A2),{1,0,1,0,1}),IF(OR(A2="",AND(ROWS(f)>1,MIN(E2,G2,I2)>MIN(f))),"",MIN(f)))
 
Upvote 0
OK, how about:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
24Peach4210$ 38.2020$ 37.2030$ 33.00$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 43.00
112apple4210$ 38.2020$ 37.2030$ 43.00
125kiwi4210$ 38.2020$ 37.2030$ 43.00$ 37.20
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER($E$2:$I$100,$A$2:$A$100=A2),{1,0,1,0,1}),IF(OR(A2="",AND(ROWS(f)>1,MIN(E2,G2,I2)>MIN(f))),"",MIN(f)))

hi

it works but still one more minor issue if you would have the orange twice or 3 times with the same $32 dollars it should just put it once makes no difference where
 
Upvote 0
Try:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
24Peach4210$ 38.2020$ 37.2030$ 33.00$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 32.00
112apple4210$ 38.2020$ 37.2030$ 43.00
125kiwi4210$ 38.2020$ 37.2030$ 43.00$ 37.20
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER($E$2:$I$100,$A$2:$A$100=A2),{1,0,1,0,1}),IF(A2="","",IF(AND(MIN(E2,G2,I2)=MIN(f),COUNTIFS($A$1:$A1,A2,$J$1:$J1,MIN(f))=0),MIN(f),"")))
 
Upvote 0
Try:

Book1
ABCDEFGHIJ
1Item #DescriptionPriceqty Price qty Price qty Price results
24Peach4210$ 38.2020$ 37.2030$ 33.00$ 33.00
32apple4210$ 38.2020$ 37.2030$ 33.00
43banana 4210$ 38.2020$ 37.2030$ 33.00
5
61orange4210$ 38.2020$ 37.2030$ 32.00$ 32.00
72apple4210$ 38.2020$ 37.2030$ 32.00$ 32.00
83banana 4210$ 38.2020$ 37.2030$ 32.00$ 32.00
9
101orange4210$ 38.2020$ 37.2030$ 32.00
112apple4210$ 38.2020$ 37.2030$ 43.00
125kiwi4210$ 38.2020$ 37.2030$ 43.00$ 37.20
Sheet7
Cell Formulas
RangeFormula
J2:J12J2=LET(f,FILTER(FILTER($E$2:$I$100,$A$2:$A$100=A2),{1,0,1,0,1}),IF(A2="","",IF(AND(MIN(E2,G2,I2)=MIN(f),COUNTIFS($A$1:$A1,A2,$J$1:$J1,MIN(f))=0),MIN(f),"")))

Thank you very much that works perfectly
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

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