Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Two way lookup

Hi group,
I've got an issue that's been bugging me for the past few days and no
amount of searching has been able to help yet. I appreciate any help
this group is able to provide in advance.

Goal: To display up to the first <bthree</b users assigned to a
site. If there are no users, nothing is returned (no #NA, etc...)
Problem: First username is always returned in the first user column,
regardless of whether or not the site ID matches.

I have an Excel worksheet with mutiple sheets. One of the sheets
contains a list of uniquely named users and a non unique site ID
number. Lots of these users will have identical site numbers but it's
all sorted by site in ascending order. In this case, site id is
column E and users is column F.

Site User
1 SmithJ
2 JohnsonB
2 AllisonK
4 ThomasT
4 SmithJ2
5 OlsonM
6 SmittyA

Another sheet has a unique list of site numbers (1,2,3,4,5...) again
in ascending order. To the right of this I would like to display the
usernames associated with the site. If there are no matches, it
should be blank. If there are more than three, those are ignored.
So, based on the example above, I would like to display:

Site User1 User2 User3
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

So far, I can get everything to display perfectly, with one exception,
using the following formula. A2=Site Number
RANGE=List of Users on other sheet (E2:F8)

{=IF(ISERROR(INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RAN GE)),ROW(1:1)),
2)),"",INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RANGE)),R OW(1:1)),2))}

The problem is that the first User1 field for the first site displays
the first User listed, regardless of whether or not the site number
matches. This user name will also be correctly displayed where the
site number matches up. So, if my site numbers were actually
0,1,2,3,4,5,6 then the incorrect result I'm seeing is:

Site User1 User2 User3
0 SmithJ
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

This is rather lengthy and a confusing post so if you're willing to
offer me advice, I'll gladly forward my spreadsheet to you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Two way lookup

Maybe this is a copout to resort to a UDF (User Defined Function):
Assume rngSite is your list of sites, Sheetx!E2:E8, and
the users are in Sheetx!F2:F8

In Module1:
Public Function FuncDC1$(rng1 As Range, rng2 As Range)
Dim Nth%, Ith%, zCell As Range
Nth = rng2.Column - rng1.Column
For Each zCell In Range("rngSite")
If zCell.Value = rng1.Value Then Ith = Ith + 1
If Ith = Nth Then
FuncDC1 = zCell.Offset(0, 1).Value
Exit Function
End If
Next zCell
FuncDC1 = ""
Exit Function
End Function ' D-C

In A2 and down, put your site numbers.
In B2, put =FuncDC1($A2,B2)
and copy down and over.

wrote:
Hi group,
I've got an issue that's been bugging me for the past few days and no
amount of searching has been able to help yet. I appreciate any help
this group is able to provide in advance.

Goal: To display up to the first <bthree</b users assigned to a
site. If there are no users, nothing is returned (no #NA, etc...)
Problem: First username is always returned in the first user column,
regardless of whether or not the site ID matches.

I have an Excel worksheet with mutiple sheets. One of the sheets
contains a list of uniquely named users and a non unique site ID
number. Lots of these users will have identical site numbers but it's
all sorted by site in ascending order. In this case, site id is
column E and users is column F.

Site User
1 SmithJ
2 JohnsonB
2 AllisonK
4 ThomasT
4 SmithJ2
5 OlsonM
6 SmittyA

Another sheet has a unique list of site numbers (1,2,3,4,5...) again
in ascending order. To the right of this I would like to display the
usernames associated with the site. If there are no matches, it
should be blank. If there are more than three, those are ignored.
So, based on the example above, I would like to display:

Site User1 User2 User3
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

So far, I can get everything to display perfectly, with one exception,
using the following formula. A2=Site Number
RANGE=List of Users on other sheet (E2:F8)

{=IF(ISERROR(INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RA NGE)),ROW(1:1)),
2)),"",INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RANGE)), ROW(1:1)),2))}

The problem is that the first User1 field for the first site displays
the first User listed, regardless of whether or not the site number
matches. This user name will also be correctly displayed where the
site number matches up. So, if my site numbers were actually
0,1,2,3,4,5,6 then the incorrect result I'm seeing is:

Site User1 User2 User3
0 SmithJ
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

This is rather lengthy and a confusing post so if you're willing to
offer me advice, I'll gladly forward my spreadsheet to you.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15,768
Default Two way lookup

See your other post

--
Biff
Microsoft Excel MVP


wrote in message
...
Hi group,
I've got an issue that's been bugging me for the past few days and no
amount of searching has been able to help yet. I appreciate any help
this group is able to provide in advance.

Goal: To display up to the first <bthree</b users assigned to a
site. If there are no users, nothing is returned (no #NA, etc...)
Problem: First username is always returned in the first user column,
regardless of whether or not the site ID matches.

I have an Excel worksheet with mutiple sheets. One of the sheets
contains a list of uniquely named users and a non unique site ID
number. Lots of these users will have identical site numbers but it's
all sorted by site in ascending order. In this case, site id is
column E and users is column F.

Site User
1 SmithJ
2 JohnsonB
2 AllisonK
4 ThomasT
4 SmithJ2
5 OlsonM
6 SmittyA

Another sheet has a unique list of site numbers (1,2,3,4,5...) again
in ascending order. To the right of this I would like to display the
usernames associated with the site. If there are no matches, it
should be blank. If there are more than three, those are ignored.
So, based on the example above, I would like to display:

Site User1 User2 User3
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

So far, I can get everything to display perfectly, with one exception,
using the following formula. A2=Site Number
RANGE=List of Users on other sheet (E2:F8)

{=IF(ISERROR(INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RAN GE)),ROW(1:1)),
2)),"",INDEX(RANGE,SMALL(IF(RANGE=A2,ROW(RANGE)),R OW(1:1)),2))}

The problem is that the first User1 field for the first site displays
the first User listed, regardless of whether or not the site number
matches. This user name will also be correctly displayed where the
site number matches up. So, if my site numbers were actually
0,1,2,3,4,5,6 then the incorrect result I'm seeing is:

Site User1 User2 User3
0 SmithJ
1 SmithJ
2 JohnsonB AllisonK
3
4 ThomasT SmithJ2
5 OlsonM
6 SmittyA

This is rather lengthy and a confusing post so if you're willing to
offer me advice, I'll gladly forward my spreadsheet to you.



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
lookup help. lookup result based on data in 2 columns lcc Excel Worksheet Functions 3 April 6th 10 01:20 PM
LOOKUP FUNCTION? (LOOKUP VALUE BEING A TIME RENERATED FROM A FORMU JCC Excel Discussion (Misc queries) 5 June 26th 09 09:15 PM
Matrix lookup/mulitple criteria lookup MarkFranklin Excel Discussion (Misc queries) 3 March 31st 08 10:15 AM
Get Cell Address From Lookup (Alternative to Lookup) ryguy7272 Excel Worksheet Functions 12 September 28th 07 10:36 PM
Join 2 Lists - Lookup value in 1 list & use result in 2nd lookup JBush Excel Worksheet Functions 3 January 3rd 07 11:14 PM


All times are GMT +1. The time now is 02:54 PM.

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"