vlookup based on 2 criteria (text and most recent date)

Giancar

Board Regular
Joined
Nov 29, 2017
Messages
52
Hi everyone,

Quite difficult to explain with my english skills! :(

In G4 I need a vlookup formula that:
  • vlookup column G (Margin)
  • if cells in column E are matching
  • if the date is the most recent vs column B
While in H4:
  • vlookup column G (Margin)
  • if cells in column E are matching
  • if cells in column D are matching
  • if the date is the most recent vs column B

    I have already added on range G4:H6 values I would like to have, as it is the easiest way to let you understand. Thank you in advance


IDDATEYEARMONTHNAMEMARGINPREVIOUS MARGINSAME MONTH MARGIN
1002014-12-11201412UK1000
1012014-12-11201412USA2000
1022014-12-11201412RUSSIA3000
100232015-05-0320155USA150020007500
193432015-05-0320155RUSSIA250030001500
121232015-05-0320155UK200010003500
892014-05-1520145UK3500
18982014-05-1520145RUSSIA1500
78562014-05-1520145USA7500

<tbody>
</tbody>
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi Glancar,

I have developed formulas to solve your problem and you can download it from the following link




Let me know if it is what you want.

Saba
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"></body>
 
Upvote 0
Are you refering to the link in post#2?
 
Upvote 0
Thank you Fluff

Giancar,

Enter the data table in the range A2 to H11

Enter the following array formula into G3 (Previous Margin columns) by pressing Shift + Control + Enter

=IFERROR(INDEX($F$3:$F$11,MATCH(MAX(IF((B3>$B$3:$B$11)*(E3=$E$3:$E$11),$B$3:$B$11,"")),IF((B3>$B$3:$B$11)*(E3=$E$3:$E$11),$B$3:$B$11,""),0)),"")

Enter the following array formula into H3 (Same Month Margin column)

=IFERROR(INDEX($F$3:$F$11,MATCH(MAX(IF((B3>$B$3:$B$11)*(E3=$E$3:$E$11)*(D3=$D$3:$D$11),$B$3:$B$11,"")),IF((B3>$B$3:$B$11)*(E3=$E$3:$E$11)*(D3=$D$3:$D$11),$B$3:$B$11,""),0)),"")

Copy the above formulas down to row 11

Let me know how you go.

Saba
 
Upvote 0
Hi Saba,

It did not work, but I made a Pivot Table and I got a similar result.
Sorry for delay on feedback.

Thanks
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,676
Members
449,463
Latest member
Jojomen56

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