Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 211
Default Lookup returning multiple entries

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 211
Default Lookup returning multiple entries

Data Table is as follows:

100 Value1
200 Value2
300 Value3
100 Value4
100 Value5
200 Value6
400 Value7

Looking up 300 would return "Value3", but 100 should return a result like:
"Value1/Value4/Value5"

--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Could u Pls provide more detail with Example

or Email me with ur Sheet



"Faraz A. Qureshi" wrote:

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 65
Default Lookup returning multiple entries

Hi! Faraz

Use this UDF

Function VlookupAll(rLookupVal, rTable As Range, lCol As Long)

Dim rCell As Range, Result

VlookupAll = CVErr(xlErrNA)

For Each rCell In rTable
If rCell = rLookupVal Then
Result = Result & "/" & rCell.Offset(, lCol - 1)
End If
Next rCell

If Result < "" Then
Result = Right(Result, Len(Result) - 1)
VlookupAll = Result
End If

End Function


Enter this Formula in Any Blank Cell

Lookup Value=100

=vlookupall(A2,A11:B2,2)

Hardeep Kanwar


"Faraz A. Qureshi" wrote:

Data Table is as follows:

100 Value1
200 Value2
300 Value3
100 Value4
100 Value5
200 Value6
400 Value7

Looking up 300 would return "Value3", but 100 should return a result like:
"Value1/Value4/Value5"

--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Could u Pls provide more detail with Example

or Email me with ur Sheet



"Faraz A. Qureshi" wrote:

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 211
Default Lookup returning multiple entries

Unbelievably XCLent!
--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Hi! Faraz

Use this UDF

Function VlookupAll(rLookupVal, rTable As Range, lCol As Long)

Dim rCell As Range, Result

VlookupAll = CVErr(xlErrNA)

For Each rCell In rTable
If rCell = rLookupVal Then
Result = Result & "/" & rCell.Offset(, lCol - 1)
End If
Next rCell

If Result < "" Then
Result = Right(Result, Len(Result) - 1)
VlookupAll = Result
End If

End Function


Enter this Formula in Any Blank Cell

Lookup Value=100

=vlookupall(A2,A11:B2,2)

Hardeep Kanwar


"Faraz A. Qureshi" wrote:

Data Table is as follows:

100 Value1
200 Value2
300 Value3
100 Value4
100 Value5
200 Value6
400 Value7

Looking up 300 would return "Value3", but 100 should return a result like:
"Value1/Value4/Value5"

--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Could u Pls provide more detail with Example

or Email me with ur Sheet



"Faraz A. Qureshi" wrote:

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 65
Default Lookup returning multiple entries

Glad to help U

"Faraz A. Qureshi" wrote:

Unbelievably XCLent!
--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Hi! Faraz

Use this UDF

Function VlookupAll(rLookupVal, rTable As Range, lCol As Long)

Dim rCell As Range, Result

VlookupAll = CVErr(xlErrNA)

For Each rCell In rTable
If rCell = rLookupVal Then
Result = Result & "/" & rCell.Offset(, lCol - 1)
End If
Next rCell

If Result < "" Then
Result = Right(Result, Len(Result) - 1)
VlookupAll = Result
End If

End Function


Enter this Formula in Any Blank Cell

Lookup Value=100

=vlookupall(A2,A11:B2,2)

Hardeep Kanwar


"Faraz A. Qureshi" wrote:

Data Table is as follows:

100 Value1
200 Value2
300 Value3
100 Value4
100 Value5
200 Value6
400 Value7

Looking up 300 would return "Value3", but 100 should return a result like:
"Value1/Value4/Value5"

--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Could u Pls provide more detail with Example

or Email me with ur Sheet



"Faraz A. Qureshi" wrote:

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Lookup returning multiple entries

Hardeep,
Is there a way to edit this code so each value is inserted in the next row
below rather than all in one cell with / between each value?

I have a summary sheet where i want to list all names that belong to a
certain city, coming from a table on a different worksheet. The city name is
in column A, the person's name in column B. I want to be able to return all
names to the summary sheet.

Thanks,
Steve

"Hardeep Kanwar" wrote:

Hi! Faraz

Use this UDF

Function VlookupAll(rLookupVal, rTable As Range, lCol As Long)

Dim rCell As Range, Result

VlookupAll = CVErr(xlErrNA)

For Each rCell In rTable
If rCell = rLookupVal Then
Result = Result & "/" & rCell.Offset(, lCol - 1)
End If
Next rCell

If Result < "" Then
Result = Right(Result, Len(Result) - 1)
VlookupAll = Result
End If

End Function


Enter this Formula in Any Blank Cell

Lookup Value=100

=vlookupall(A2,A11:B2,2)

Hardeep Kanwar


"Faraz A. Qureshi" wrote:

Data Table is as follows:

100 Value1
200 Value2
300 Value3
100 Value4
100 Value5
200 Value6
400 Value7

Looking up 300 would return "Value3", but 100 should return a result like:
"Value1/Value4/Value5"

--
Do check "Yes" if this post is helpful,
Best Regards,

Faraz


"Hardeep Kanwar" wrote:

Could u Pls provide more detail with Example

or Email me with ur Sheet



"Faraz A. Qureshi" wrote:

If a value is appearing once in the lookup array, I want operation of a
simple Vlookup, however, if an entry appears twice or more times how to have
a multiple return like:
Value1/Value2/Value3

Thanx in advance.

--
Best Regards,

Faraz

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning Multiple Values in a lookup mickn74 Excel Worksheet Functions 7 January 20th 09 09:53 PM
returning multiple cells for a single lookup esloan Excel Discussion (Misc queries) 2 August 22nd 07 06:52 PM
Returning multiple indices for a lookup [email protected] Excel Worksheet Functions 4 June 29th 07 12:04 AM
Lookup Returning Multiple Results joe1182 Excel Discussion (Misc queries) 5 February 1st 06 12:02 PM
Returning multiple instances of the same lookup value lo3t3ch Excel Worksheet Functions 7 December 1st 05 03:25 PM


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"