Return the value of a vlookup only if negative.

albertocantupomares

New Member
Joined
Jun 4, 2021
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
I was wondering if someone would help me with the following situation,

On another sheet I used Vlookup to get the "Request date" based on the part number, in this case if I use =Vlookup,(1.0617874,A3:J5,7,False) I get "5/31/2021", but I wanted to know how can I get to return the request date, base on the balance, in this case the first "Request Date" value with negative "Balance" (J column). In this example I need the value from G5 because the balance on the same row is the first one with negative number (-31,300).

Also I would appreciate if you could let me know how to ask this kind of question properly, I not sure if I asked this correctly or used more than needed information.

I appreciate the support

tabla.JPG
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to the MrExcel forum!

First, you posed your question just fine. However, I would recommend downloading and using the XL2BB add-in. See the link in my signature or the reply box. It makes it much easier for the helpers here to copy and test with your data without having to retype everything. It's easy to download, install, and use.

Next, see if this works for you:

Book1
ABCDEFGHIJKLMN
1
2Part NumberRequest DateBalancePart NumberDate for negative balance
31.0617875/31/2021123001.0617876/7/2021
41.0617875/31/2021700
51.0617876/7/2021-31300
61.0617876/14/2021-63300
Sheet15
Cell Formulas
RangeFormula
N3N3=INDEX(Sheet15!G3:G6,AGGREGATE(15,6,(ROW(Sheet15!G3:G6)-ROW(Sheet15!G3)+1)/(Sheet15!A3:A6=M3)/(Sheet15!J3:J6<0),1))
 
Upvote 0
Solution
Another approach:

Book3
ABCDEFGHIJKL
2P:art #RevDescOrder #PO #SOReq DateOrigLeftBal1.0617874
31.06178745/31/202112,3006/7/2021
41.06178745/21/2021700
51.06178746/7/2021-31,300
61.06178746/14/2021-63,300
72.123457/10/2021-20,000
82.06188886/21/2021-31,300
Sheet1
Cell Formulas
RangeFormula
L3L3=INDEX(G3:G12,MATCH(MAX(IF(((L2=A3:A12)*J3:J12)<0,J3:J12)),J3:J12,0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Welcome to the MrExcel forum!

First, you posed your question just fine. However, I would recommend downloading and using the XL2BB add-in. See the link in my signature or the reply box. It makes it much easier for the helpers here to copy and test with your data without having to retype everything. It's easy to download, install, and use.

Thanks a lot, this worked almost great, the only thing that I notice is that the sometimes the part number is not entirely as number it may contain some letter in it. I was wondering how to do the proper fix for this?? should I add the little " ' " at the first of the part number on M3?
 
Upvote 0
It shouldn't matter if the part number is numeric or not, the formula should find it, as long as it is saved the same way. Is column A formatted as text? If so, format M3 as text. I wondered about the part number format, since if you entered it as 1.067845, then Excel would interpret as a number, and if it was long enough, you'd have problems with Excel's 15 digit limit. Unless you formatted the cells as text. So try formatting everything the same and see what happens. If it doesn't work, see if you can provide an example.
 
Upvote 0
I appreciate the support, after some adjustments it worked, definitely need to work and learn some of the formulas you share.
Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,869
Messages
6,122,012
Members
449,060
Latest member
LinusJE

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