IF AND with vlookup

garypea123

Board Regular
Joined
Mar 16, 2020
Messages
221
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

New to this site (1st post I think)..

I would like some advice on the attached file. I am trying to put in a formula if F5 where it is looking at the information in B5 and then looking at the table numbers in L:M.

If B3 falls between the numbers in L:M then it return the value in N.

I assuming this is an IF(and) formula with possible VLOOKUP...

I have attached test file to help. And have manually populated my required results..

Thanks,
Gary
 

Attachments

  • Excel 1.PNG
    Excel 1.PNG
    20.5 KB · Views: 8

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Maybe

=LOOKUP(B5,$L:$L,$N:$N)

It's preferable if you use XL2BB to upload examples (button on reply box toolbar), not screen captures.
 
Upvote 0
Yes, that works in theory, and thank you ever so much for the advice on upload..

However, my concern is that it is not really looking at the numbers between L:M. I have supplied an example where it shows that if I use a number which does not exist that it returns an value which is not true.

In essence I want it to look at B4 (F4), B5 (G4), B6 (H4) and then look at L:M and if the number falls between it will choose the weight in Column N.

I guess my point is that should a number not fit into between min and max then I need to highlight an issue to me (Error code or something). It should not happen as my weights should have no gaps. But if there was an issue than I prefer it not to suggest a band weight that actually does not exist (for example 1000 says band weight 799 - 998g which would be wrong as the max is 999...

Hopefully that makes sense :)

I
Excel 2.PNG
 
Upvote 0
It should not happen as my weights should have no gaps.
Actually there are gaps which I missed, here's the fixed formula.
Cell Formulas
RangeFormula
F3:H3F3=$N$3
F4:H7F4=IFERROR(INDEX($N:$N,AGGREGATE(15,6,ROW($L$4:$L$15)/($L$4:$L$15<=B4)/($M$4:$M$15>=B4),1)),"Error")
M4:M15M4=L4+199
N4:N15N4=L4&"g - "&M4&"g"
L5:L15L5=L4+200
 
Upvote 0
Sorry for late reply!! - Seems to work perfectly... :) This exercise is on delay at the minute, but I am revisiting
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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