Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2018, 05:31 AM
paxon paxon is offline Vlookup or Index for multiple rows? Windows XP Vlookup or Index for multiple rows? Office 2007
Novice
Vlookup or Index for multiple rows?
 
Join Date: Feb 2016
Posts: 13
paxon is on a distinguished road
Default Vlookup or Index for multiple rows?

Hi;

with vlookup i can only get the 1st value that the formula found. in this case is only 2017.

But what formula can I use if I want to show that there are several contracts expiring for the Client in sheet2?



Ideally in sheet 1 column J I would like to see 2011, 2017, 2018 as there are multiple expiration date.
(I have added manually in sheet1 column J4 the result I would like to see with the formula)

Thanks
Attached Files
File Type: xlsx Supplier.xlsx (210.1 KB, 16 views)
Reply With Quote
  #2  
Old 10-01-2018, 05:41 AM
p45cal's Avatar
p45cal p45cal is offline Vlookup or Index for multiple rows? Windows 10 Vlookup or Index for multiple rows? Office 2016
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

The tables on all the sheets in your sample workbook appear to be derived from pivot tables.
It's more likely we can help better with the source data for those pivot tables, desensitised if necessary.
Reply With Quote
  #3  
Old 10-01-2018, 09:17 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Vlookup or Index for multiple rows? Windows 7 64bit Vlookup or Index for multiple rows? Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Or https://www.ablebits.com/office-addi...-values-excel/
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #4  
Old 10-09-2018, 02:19 AM
paxon paxon is offline Vlookup or Index for multiple rows? Windows XP Vlookup or Index for multiple rows? Office 2007
Novice
Vlookup or Index for multiple rows?
 
Join Date: Feb 2016
Posts: 13
paxon is on a distinguished road
Default

Hi This is the further data from Pivot table (see tab Pivot contract expiration).

you will see that in Pivot table I have contract starting in 2011-2017-2018. I would be interested in having the contract expiration date in tab "final result" column "J4".

With Vlokkup is only taking the 1st value which is finding 2017, how can i include the 2018 and 2011?

Thanks
Attached Files
File Type: xlsx Supplier.xlsx (308.0 KB, 10 views)
Reply With Quote
  #5  
Old 10-09-2018, 07:07 AM
p45cal's Avatar
p45cal p45cal is offline Vlookup or Index for multiple rows? Windows 10 Vlookup or Index for multiple rows? Office 2016
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

The "raw data" you supply isn't raw data but never mind. There are problems with this; some dates aren't dates at all.


In the attached in the final result sheet, in cell J4, your stated requirement (highlighted in yellow).

In K4, a formula:
Code:
=TEXTJOIN(", ",TRUE,IF((('Contracts by Supplier raw data'!$B$3:$B$6=B4)*('Contracts by Supplier raw data'!$C$3:$C$6=C4)*('Contracts by Supplier raw data'!$D$3:$D$6=D4))=1,'Contracts by Supplier raw data'!$AH$3:$AH$6))
but since I suspect you have Excel 2013 the TextJoin function is unavailable. This returns duplicate years.
In cell L4 a formula:
Code:
=TxtJn('Contracts by Supplier raw data'!$B$3:$B$6,B4,'Contracts by Supplier raw data'!$C$3:$C$6,C4,'Contracts by Supplier raw data'!$D$3:$D$6,D4,'Contracts by Supplier raw data'!$AH$3:$AH$6)
This is a user-defined function the code of which (only for interest) is:
Code:
Function TxtJn(Rng1, Crit1, Rng2, Crit2, Rng3, Crit3, RngToJoin)
Rng1Vals = Rng1.Value
Rng2Vals = Rng2.Value
Rng3Vals = Rng3.Value
Crit1Val = UCase(Crit1.Value)
Crit2Val = UCase(Crit2.Value)
Crit3Val = UCase(Crit3.Value)
RngToJoinVals = RngToJoin.Value
uniques:
Set d = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(RngToJoinVals)
  If UCase(Rng1Vals(i, 1)) = Crit1Val And UCase(Rng2Vals(i, 1)) = Crit2Val And UCase(Rng3Vals(i, 1)) = Crit3Val Then
    d(RngToJoinVals(i, 1)) = 1
  End If
Next i
myAry = d.keys
'sort:
For i = LBound(myAry) To UBound(myAry) - 1
  For j = i + 1 To UBound(myAry)
    If myAry(i) > myAry(j) Then
      Temp = myAry(j): myAry(j) = myAry(i): myAry(i) = Temp
    End If
  Next j
Next i
TxtJn = Join(myAry, ", ")
 End Function
No duplicates and in ascending order.


There will be some built-in-worksheet-functions-only formulae that could be concocted but they'll be long and complicated and vey difficult to maintain and understand. Although the code for the user-defined function I've suggested isn't simple, the use of the user-defined function on a sheet is relatively straightforward.
Attached Files
File Type: xlsm msofficeforums40515Supplier.xlsm (321.1 KB, 9 views)
Reply With Quote
  #6  
Old 10-11-2018, 08:10 AM
paxon paxon is offline Vlookup or Index for multiple rows? Windows XP Vlookup or Index for multiple rows? Office 2007
Novice
Vlookup or Index for multiple rows?
 
Join Date: Feb 2016
Posts: 13
paxon is on a distinguished road
Default

Thanks for your great help!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup or Index for multiple rows? VLookup or Index Multiple Tables mycon73 Excel 4 07-27-2018 06:53 AM
Index/match, Vlookup? kelwea Excel 1 01-24-2017 10:19 AM
Can I substitute Vlookup with Index paxon Excel 4 03-10-2016 07:03 AM
Match Index with sumproduct/vlookup angie.chang Excel 1 06-18-2012 08:47 AM
Vlookup or Index for multiple rows? Vlookup or Index/Match - Multiple Criteria ruci1225 Excel 1 01-15-2012 07:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft