Hi there. This seems like it should be really easy, but I've been wracking my brain over it for the last few hours.
I have a spreadsheet I'm using that has a number of locations in one row, and I want to retrieve the data from the appropriate column based on the location name. For the most part, that's simple enough, (HLOOKUP does the trick), but for locations that have duplicates, I'm stumped.
I've created some dummy data and can find the nth instance of a duplicate when the list is vertical (Cells A1:B6):
[TABLE="width: 500"]
<tbody>[TR]
[TD]Philadelphia[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]Long Beach[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Honolulu[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Miami[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Philadelphia[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Long Beach[/TD]
[TD]F[/TD]
[/TR]
</tbody>[/TABLE]
The following formula searches for the 2nd instance of Philadelphia, and correctly returns "E" as a result:
{=INDEX($B$1:$B$6,SMALL(IF($A$1:$A$6="Philadelphia",ROW($A$1:$A$6),""),2),1)}
However, my attempts to translate this to a horizontal list (and thus use that as a basis to work with the spreadsheet in question) have failed (Cells A1:F2):
[TABLE="width: 500"]
<tbody>[TR]
[TD]Philadelphia[/TD]
[TD]Long Beach[/TD]
[TD]Honolulu[/TD]
[TD]Miami[/TD]
[TD]Philadelphia[/TD]
[TD]Long Beach[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
</tbody>[/TABLE]
{=INDEX($A$2:$F$2,SMALL(IF($A$1:$F$1="Philadelphia",COLUMN($A$1:$F$1),""),2),1)} gets met with a "#REF!" error.
All of the online tutorials that I've been able to locate show me how to work with a vertical list, which I can already do, but I can't see the horizontal equivalent, which seems like it should be easy...
I'm hoping someone can help me out! (Thanks in advance!)
I have a spreadsheet I'm using that has a number of locations in one row, and I want to retrieve the data from the appropriate column based on the location name. For the most part, that's simple enough, (HLOOKUP does the trick), but for locations that have duplicates, I'm stumped.
I've created some dummy data and can find the nth instance of a duplicate when the list is vertical (Cells A1:B6):
[TABLE="width: 500"]
<tbody>[TR]
[TD]Philadelphia[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]Long Beach[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Honolulu[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Miami[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Philadelphia[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Long Beach[/TD]
[TD]F[/TD]
[/TR]
</tbody>[/TABLE]
The following formula searches for the 2nd instance of Philadelphia, and correctly returns "E" as a result:
{=INDEX($B$1:$B$6,SMALL(IF($A$1:$A$6="Philadelphia",ROW($A$1:$A$6),""),2),1)}
However, my attempts to translate this to a horizontal list (and thus use that as a basis to work with the spreadsheet in question) have failed (Cells A1:F2):
[TABLE="width: 500"]
<tbody>[TR]
[TD]Philadelphia[/TD]
[TD]Long Beach[/TD]
[TD]Honolulu[/TD]
[TD]Miami[/TD]
[TD]Philadelphia[/TD]
[TD]Long Beach[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
</tbody>[/TABLE]
{=INDEX($A$2:$F$2,SMALL(IF($A$1:$F$1="Philadelphia",COLUMN($A$1:$F$1),""),2),1)} gets met with a "#REF!" error.
All of the online tutorials that I've been able to locate show me how to work with a vertical list, which I can already do, but I can't see the horizontal equivalent, which seems like it should be easy...
I'm hoping someone can help me out! (Thanks in advance!)