ROUNDUP and MIN with IF/AND

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Excel Formula:
=ROUND(MIN(IF(AND(Jan!$B:$B>=$O$22,Jan!$C:$C>=$O$52),Jan!$A:$A,0)*Jan!$A:$A,0),0)

This is my latest attempt at a formula that doesn't appear to work. If I don't include the AND statement, I can get the data to populate just fine. But I need 2 conditions to be true. First, when searching Col B, the results need to be above whatever variable is entered into cell O22. Also, when searching Col C, we are looking for anything greater than the variable in O52.

I would like the lowest value in Col A to be generated based on the above 2 requirements. (EX: If O22=97% and O52=52, this would result in 23. What is wrong with the formula?



AgentsSVLShrink
1​
0.093207​
31​
2​
0.257581​
32​
3​
0.392158​
33​
4​
0.502341​
34​
5​
0.592551​
35​
6​
0.666409​
36​
7​
0.726879​
37​
8​
0.776387​
38​
9​
0.816921​
39​
10​
0.850108​
40​
11​
0.877279​
41​
12​
0.899524​
42​
13​
0.917737​
43​
14​
0.932649​
44​
15​
0.944858​
45​
16​
0.954853​
46​
17​
0.963037​
47​
18​
0.969737​
48​
19​
0.975223​
49​
20​
0.979714​
50​
21​
0.983391​
51​
22​
0.986402​
52​
23​
0.988867​
53​
24​
0.990885​
54​
25​
0.992537​
55​
26​
0.99389​
56​
27​
0.994998​
57​
 

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.
How is it 23? Just by testing the AND() conditions alone would return 19 as the lowest.
Book2
ABCDEFG
1AgentsSVLShrink
210.093207310FALSE19
320.25758132FALSE22
430.39215833FALSE23
540.50234134FALSE24
650.59255135FALSE25
760.66640936FALSE26
870.72687937FALSE27
980.77638738FALSE
1090.81692139FALSE
11100.85010840FALSE
12110.87727941FALSE
13120.89952442FALSE
14130.91773743FALSE
15140.93264944FALSE
16150.94485845FALSE
17160.95485346FALSE
18170.96303747FALSE
19180.96973748FALSE
20190.97522359TRUE
21200.97971450FALSE
22210.98339151FALSE
23220.98640252TRUE
24230.98886753TRUE
25240.99088554TRUE
26250.99253755TRUE
27260.9938956TRUE
28270.99499857TRUE
Sheet1
Cell Formulas
RangeFormula
E2E2=ROUND(MIN(IF(AND($B2:$B28>=$O$22,$C2:$C28>=$O$52),$A2:$A28,0)*$A2:$A28,0),0)
G2:G8G2=FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52))
F2:F28F2=AND($B2>=$O$22,$C2>=$O$52)
Dynamic array formulas.


And what are you trying to do with this part of the formula:
=ROUND(MIN(IF(AND(Jan!$B:$B>=$O$22,Jan!$C:$C>=$O$52),Jan!$A:$A,0)*Jan!$A:$A,0),0)

And as you can see, FILTER can get you the results that meet both conditions, then apply the MIN() function to those results and you should be fine.
Book2
GH
21919
322
423
524
625
726
827
Sheet1
Cell Formulas
RangeFormula
G2:G8G2=FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52))
H2H2=MIN(FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52)))
Dynamic array formulas.
 
Upvote 0
And what are you trying to do with this part of the formula:
=ROUND(MIN(IF(AND(Jan!$B:$B>=$O$22,Jan!$C:$C>=$O$52),Jan!$A:$A,0)*Jan!$A:$A,0),0)

I was just trying to get the basic formula to result in something other than an error so that was added purely to try and produce a result but can be ignored.

If the value in O52 is 52, that is Row 23 which matches up to Col A=22. If the value in O22 is 97%, that generates a result in Row 20 (Col A=19). If the 2 outcomes, since 22 is higher, the resulting value from Column A should be 22 and not 19 (apologies for mistyping 23 in the initial request). That's what I'm trying to come up with. Does that make sense?
 
Upvote 0
And what are you trying to do with this part of the formula:
=ROUND(MIN(IF(AND(Jan!$B:$B>=$O$22,Jan!$C:$C>=$O$52),Jan!$A:$A,0)*Jan!$A:$A,0),0)

I was just trying to get the basic formula to result in something other than an error so that was added purely to try and produce a result but can be ignored.

If the value in O52 is 52, that is Row 23 which matches up to Col A=22. If the value in O22 is 97%, that generates a result in Row 20 (Col A=19). If the 2 outcomes, since 22 is higher, the resulting value from Column A should be 22 and not 19 (apologies for mistyping 23 in the initial request). That's what I'm trying to come up with. Does that make sense?
Yes it makes sense, and I realize I mistyped a value in col C. When sample data is posted in the table format you used, I have to manually re-enter it in excel because it copies as text and doesn't recognize numbers. So, the formula in H2 should be what you are after.

Book2
ABCDEFGH
1AgentsSVLShrink
210.093207310FALSE2222
320.25758132FALSE23
430.39215833FALSE24
540.50234134FALSE25
650.59255135FALSE26
760.66640936FALSE27
870.72687937FALSE
980.77638738FALSE
1090.81692139FALSE
11100.85010840FALSE
12110.87727941FALSE
13120.89952442FALSE
14130.91773743FALSE
15140.93264944FALSE
16150.94485845FALSE
17160.95485346FALSE
18170.96303747FALSE
19180.96973748FALSE
20190.97522349FALSE
21200.97971450FALSE
22210.98339151FALSE
23220.98640252TRUE
24230.98886753TRUE
25240.99088554TRUE
26250.99253755TRUE
27260.9938956TRUE
28270.99499857TRUE
Sheet1
Cell Formulas
RangeFormula
E2E2=ROUND(MIN(IF(AND($B2:$B28>=$O$22,$C2:$C28>=$O$52),$A2:$A28,0)*$A2:$A28,0),0)
G2:G7G2=FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52))
H2H2=MIN(FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52)))
F2:F28F2=AND($B2>=$O$22,$C2>=$O$52)
Dynamic array formulas.
 
Upvote 0
Solution
Try this:

Book1
ABCDEFG
1AgentsSVLShrinkSVLShrinkAgents
210.0932073197%5222
320.2575813222
430.39215833
540.50234134
650.59255135
760.66640936
870.72687937
980.77638738
1090.81692139
11100.85010840
12110.87727941
13120.89952442
14130.91773743
15140.93264944
16150.94485845
17160.95485346
18170.96303747
19180.96973748
20190.97522349
21200.97971450
22210.98339151
23220.98640252
24230.98886753
25240.99088554
26250.99253755
27260.9938956
28270.99499857
Sheet1
Cell Formulas
RangeFormula
G2G2=INDEX(A2:A28,MATCH(1,(B2:B28>=E2)*(C2:C28>=F2),0))
G3G3=INDEX(FILTER(A2:A28,(B2:B28>=E2)*(C2:C28>=F2)),1)
 
Upvote 0
Yes it makes sense, and I realize I mistyped a value in col C. When sample data is posted in the table format you used, I have to manually re-enter it in excel because it copies as text and doesn't recognize numbers. So, the formula in H2 should be what you are after.

Book2
ABCDEFGH
1AgentsSVLShrink
210.093207310FALSE2222
320.25758132FALSE23
430.39215833FALSE24
540.50234134FALSE25
650.59255135FALSE26
760.66640936FALSE27
870.72687937FALSE
980.77638738FALSE
1090.81692139FALSE
11100.85010840FALSE
12110.87727941FALSE
13120.89952442FALSE
14130.91773743FALSE
15140.93264944FALSE
16150.94485845FALSE
17160.95485346FALSE
18170.96303747FALSE
19180.96973748FALSE
20190.97522349FALSE
21200.97971450FALSE
22210.98339151FALSE
23220.98640252TRUE
24230.98886753TRUE
25240.99088554TRUE
26250.99253755TRUE
27260.9938956TRUE
28270.99499857TRUE
Sheet1
Cell Formulas
RangeFormula
E2E2=ROUND(MIN(IF(AND($B2:$B28>=$O$22,$C2:$C28>=$O$52),$A2:$A28,0)*$A2:$A28,0),0)
G2:G7G2=FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52))
H2H2=MIN(FILTER(A2:A28,($B2:$B28>=$O$22)*($C2:$C28>=$O$52)))
F2:F28F2=AND($B2>=$O$22,$C2>=$O$52)
Dynamic array formulas.
That took care of it. Thank you!!
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,153
Members
452,615
Latest member
bogeys2birdies

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