look for a set of values and then return the closest lower in this set

vlbv

New Member
Joined
Feb 12, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,
I need the excel to return the lower closest value on a vlookup (?) result, that corresponds to a set of values, and I can't figure out how to build this formula.
Let me try to explain a little better:
Excel question.png

So, I need the excel to return all the values that match "orange" (so, 20, 60, 10 and 50). And then, within these values, I need the excel to return the closest lower to 45 (so I need it to return "20").
Also... I have an enterprise account and I cannot enable Macros...
Can someone help, please...?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi try this:

=MAXIFS(B:B,A:A,$E$1,B:B,"<"&$H$3)

Obviously alter ranges to match your sheet.
 
Upvote 0
Hi try this:

=MAXIFS(B:B,A:A,$E$1,B:B,"<"&$H$3)

Obviously alter ranges to match your sheet.

Thank you for your help! Unfortunately, I don't have this formula available on my office version (I have the 2016 version).
I have tried a max(if(...(if...) function, but I must be doing something wrong, because I can't make it work! This is what I've tried: =MAX(IF(E1=A2:A10;IF(B2<H3;0);0)) it returns 0

Can you help, please?
 
Upvote 0
How about
ZFluff.xlsm
ABCDE
1ColourValueColourOrange
2Orange20Target45
3Black50Result20
4Orange60
5Orange10
6Yellow30
7White20
8Pink40
9Orange50
10White30
Data
Cell Formulas
RangeFormula
E3E3=AGGREGATE(14,6,B2:B10/((A2:A10=E1)*(B2:B10<=E2)),1)
 
Upvote 0
How about
ZFluff.xlsm
ABCDE
1ColourValueColourOrange
2Orange20Target45
3Black50Result20
4Orange60
5Orange10
6Yellow30
7White20
8Pink40
9Orange50
10White30
Data
Cell Formulas
RangeFormula
E3E3=AGGREGATE(14,6,B2:B10/((A2:A10=E1)*(B2:B10<=E2)),1)


Thank you so much!! I think this is working! Now I just have to complete with a condition for: if my "target" is lower than the values in column B, than it should assume the lowest value in this column. I'll try to get there alone, but I will most certainly accept help! :)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,771
Messages
6,126,799
Members
449,337
Latest member
BBV123

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