Returning value above searched row

pharside

New Member
Joined
Oct 7, 2018
Messages
18
I'm tryin to return a value above the searched row. I've tried a couple options and here is what I have tried:

=HLOOKUP(LEFT(Y4, 4), CHOOSE({1;2},B3:M3,B1:M1), 2, FALSE)

=INDEX(A1:M3,MATCH(LEFT(Y5,4),A1:M3,0),MATCH(LEFT(Y5,4),A1:M3,0))

=VLOOKUP("AISLE", A1:M3, MATCH(LEFT(Y6, 4), A1:M3, 0), FALSE)

I don't have any experience with index, choose, or match as you can likely tell. I am trying to search row 3 for the left 4 of the value in Y4,Y5, and Y6 and then return the content of the cell 2 rows above (column headers).

Any help here would be appreciated.
 
What about the HLOOKUP and CHOOSE combination? I am not sure why I can't get it to work, but that seems like a viable option.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
AISLE

_
A1
_
A2
_
A3
_
A4
_
A5
_
B1
_
B2
_
B3
_
B4
_
B5
_
B6
_
B7
EMP #
0050
0050
0050
0050
0050
0050
0050
0050
0050
0050
0050
0050
PR 0-1
2
1
2
PR 2-5
2
2
2
4
3
4
PR 6-9
10

<tbody>
</tbody>
OK, I think I found out why none of my solutions are working but I don't know a fix for it. The cells I am searching all have =IFERROR(VALUE('01 Data'![cell reference]), ""). So my search array is full of value() functions. I thought maybe this might mess up my search so I tried a simple VLOOKUP and still got an error. I would try searching the source data but I'm not sure how I could do that. Here is what the source data looks like: (SEE ABOVE)

As you can see, the column labels (aisle) do not line up with the emp#. If I knew of a way to adjust the return value (aisle) to accommodate the shift in reference to the search value (emp#), then I could just use the source data.

(also, just a side note, all the numbers in my source data are stored as text.)
 
Last edited:
Upvote 0
ok, I've narrowed down my issue. I'm not sure why, but LEFT() function is not working with VLOOKUP(). Any idea why?

If I type in the VLOOKUP directly what I want to search, no problems. As soon as I use LEFT() to identify search criteria, I get an #N/A.
 
Last edited:
Upvote 0
Postings like "=function" are not helpful; better post what value must obtain.

Based on your initial post, I'd venture:

=OFFSET(INDEX(B3:M3,MATCH(LEFT(Y4,4)&"*",B3:M3,0)),-1,0)

This solution works if I manually type in the MATCH criteria vs. using LEFT. Do you know why LEFT() isn't working?
 
Upvote 0
Care to post the value in Y4 as is and the value in B3:M3 with which it must match?


Y4 is 0050 - Mack, C. It is actually part of pivot table so it would change based on the source data when I refresh it. The only data that appears in B3:M3 are the emp#'s (i.e. 0050) that is why I am trying to use LEFT(Y4, 4) for my search criteria.

It may also be important to note that B3:M3 all have the following function:
=IF('01 Data'!B2=" MULT ", "MULT", IFERROR(VALUE('01 Data'!B2), ""))
This looks at my source data sheet to fill in the appropriate information.
 
Upvote 0
Which cell of B3:M3 has this 0050?

well, right now all of them but that changes depending on who is assigned to what aisle. Often, there is more than one aisle assigned to one person.

Again, B3:M3 all have VALUE() functions in them and your solution works if I manually type in the B3:M3 cells the employee ID number (such as 0050), so I think maybe if I can change the VALUE() function to something else your solution would work. I tried using a TEXT() function, but still didn't work.
 
Last edited:
Upvote 0
well, right now all of them but that changes depending on who is assigned to what aisle. Often, there is more than one aisle assigned to one person.

Again, B3:M3 all have VALUE() functions in them and your solution works if I manually type in the B3:M3 cells the employee ID number (such as 0050), so I think maybe if I can change the VALUE() function to something else your solution would work. I tried using a TEXT() function, but still didn't work.

Would you please just answer the question I posed? "Which cell of B3:M3 has this 0050 when we have LEFT(Y4,4) = 0050? Please do not feed more than just a straight answer to this question?
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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