Conditional VLOOKUP

thebenjames

New Member
Joined
Mar 12, 2021
Messages
12
Office Version
  1. 2019
Platform
  1. Windows
What is the easiest way to pull through the data I need into columns H and I for each ULN? Some ULNs have multiple entries for "1 - Total training price" so I would like the latest one if possible. Some also don't necessarily have a "2 - Total assessment price", but if that pulls through as N/A that is absolutely fine.

finances.csv
ABCDEFGHIJ
1ULNTNP typeTNP amountTNP dateULN1 - Total training price2 - Total assessment priceTotal
210000015621 - Total training price2700017/09/20191000001562
310001591231 - Total training price1323128/04/20201000159123
410001591232 - Total assessment price140028/04/20201000208663
510002086631 - Total training price1140008/01/20201002135582
610021355821 - Total training price1090001/07/20211002442620
710021355822 - Total assessment price50001/07/20211002535335
810021355821 - Total training price1140020/05/20211036930806
910024426201 - Total training price1649015/10/20201039989224
1010024426202 - Total assessment price151015/10/20201060682426
1110025353351 - Total training price1140008/01/20201114082901
1210369308061 - Total training price2228514/10/20191124359426
1310369308062 - Total assessment price171514/10/20191135648777
1410399892241 - Total training price1971018/09/20181143934996
1510399892242 - Total assessment price69018/09/20181151349940
1610606824262 - Total assessment price45007/05/20191176791922
1710606824261 - Total training price2655025/09/20181188538526
1811140829011 - Total training price1649013/05/20211191531456
1911140829012 - Total assessment price151013/05/20211193462966
Sheet3
 

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.
May be
VBA Code:
Sub test2()
Dim a As Variant
Dim i As Long
a = Sheets("sheet1").Cells(1).CurrentRegion.Value2
With CreateObject("scripting.dictionary")
        For i = 2 To UBound(a)
            If Not .Exists(a(i, 1)) Then
                .Add a(i, 1), Array(a(i, 1), a(i, 3), "")
             Else
             w = .Item(a(i, 1))
             w(2) = a(i, 3)
             .Item(a(i, 1)) = w
            End If
        Next
Sheets("sheet1").Cells(2, 7).Resize(.Count, 3) = Application.Transpose(Application.Transpose(.items))
End With
End Sub
 
Last edited:
Upvote 0
Is this what you're looking for?
Book1
ABCDEFGHIJ
1ULNTNP typeTNP amountTNP dateULN1 - Total training price2 - Total assessment priceTotal
210000015621 - Total training price2700017-Sep-19100000156227000027000
310001591231 - Total training price1323128-Apr-20100015912313231140014631
410001591232 - Total assessment price140028-Apr-20100020866311400011400
510002086631 - Total training price1140008-Jan-2010021355821090050011400
610021355821 - Total training price1090001-Jul-21100244262016490151018000
710021355822 - Total assessment price50001-Jul-21100253533511400011400
810021355821 - Total training price1140020-May-21103693080622285171524000
910024426201 - Total training price1649015-Oct-2010399892241971069020400
1010024426202 - Total assessment price151015-Oct-2010606824262655045027000
1110025353351 - Total training price1140008-Jan-20111408290116490151018000
1210369308061 - Total training price2228514-Oct-191124359426000
1310369308062 - Total assessment price171514-Oct-191135648777000
1410399892241 - Total training price1971018-Sep-181143934996000
1510399892242 - Total assessment price69018-Sep-181151349940000
1610606824262 - Total assessment price45007-May-191176791922000
1710606824261 - Total training price2655025-Sep-181188538526000
1811140829011 - Total training price1649013-May-211191531456000
1911140829012 - Total assessment price151013-May-211193462966000
Sheet2
Cell Formulas
RangeFormula
H2:I19H2=MAXIFS($C:$C,$A:$A,$G2,$B:$B,H$1,$D:$D,MAXIFS($D:$D,$A:$A,$G2,$B:$B,H$1))
J2:J19J2=SUM(H2:I2)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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