[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# Excel Vlookup return a formula relative to current sheet

Posted on 2011-09-18
Medium Priority
340 Views
Hi Experts.

Consider this scenario.

A vlookup on Sheet1 returns a value from Sheet2.  The cell it successfully finds and returns on Sheet2 is this formula    =E1&” is good”

I want the vlookup to display that on Sheet1 and the formula to look at E1 on Sheet1.  Currently it’s still referring to E1 on Sheet2.

Obviously if the formula on Sheet2 was  =Sheet1!E1&" is good"  then the result of vlookup would work but I want to use Sheet2 to be accessed from multiple sheets.  Therefore Sheet2 must stay generic and refer to E1 and the other sheets will each have the correct value in their own E1.

A simple example is attached.

How do I achieve this?  I hope my question is clear.

Thanks,

Will

vlookup-help.xlsx
0
Question by:willnjen
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 5
• 3
• 2
• +1

LVL 50

Expert Comment

ID: 36558445
Hello,

Sorry, I'm confused. What do you want where?

On Sheet1 you look up a value from Sheet2. So far so good.

Do you want in Sheet1, B1

=E1&VLOOKUP(A1,Sheet2!A1:B3,2)

Can you post a sample with several sheets and the desired results in each sheet?

cheers, teylyn
0

LVL 42

Expert Comment

ID: 36558478
My two cents.

I don't think you need the reference to E1 in Sheet2.  You just need the factor (e.g., 1,2,3) and the results of that factor (e.g., good, average, bad)

Then, from any other sheet in the workbook, you can use the formula (example below pasted in A1, having a name in E1:

=E1 & VLOOKUP(A1,Sheet2!\$A\$1:\$B\$3,2,0)

Thus, the name in E1 is the first, then the result of looking up A1 in the table Sheet2!A1:B3, returning column 2 with exact match 0.

You can copy this formula pretty much anywhere, where Vlookup(A1 <- that points to the factor of 1,2,3 and E1 <- that points to the person's name.

I hope I'm adding clarity here.

See example spreadsheet where I made slight changes, and added another sheet tab with names and factors/ratings, so you can see it play out.

Cheers,

Dave
vlookup-help.xlsx
0

Author Comment

ID: 36558482
Hi Teylyn

Have a look at the file vlookup-help2.xlsx attached to this answer.  There are two sheets in the file.

Cheers,

Will  vlookup-help2.xlsx
0

Author Comment

ID: 36558502
Hi Dlmille

Sorry, I think I've simplied my example too much.  In reality, the cell returned by the vlookup will be something like....

"Jim is good. He is able to do stuff.  Jim is always working hard".

That will be a formula like

=E1&" is good. "&E2&" is able to do stuff. "&E1&" is always working hard"

E2 will be a He/She if Jim is a boy or girl.

All that info of name and boy/girl will be on Sheet1.  The formula found by the lookup needs to refer to the info in sheet1.  Sheet1 will be duplicated 30 times with all sheets vlookuping Sheet2.
0

Author Comment

ID: 36558512
in plain english, the formula on sheet2 needs to be...
=E1 from the current sheet & " is good."

Then when the vlookup formula on sheet one displays that formula above, the E1 gets it's value from the current sheet1.

Sorry, late in the day here in New Zealand so hope I'm being clear.

Cheers,

Will
0

LVL 42

Expert Comment

ID: 36558526
I agree with teylyn, a more thorough working example (without formulas, if need be) with guidance on what you're trying to do is indeed in order.

You will undoubtedly need to create these lists of he/she's, actions (working hard, able to do stuff, etc.) and decide how you want to leverage them (re: put them all together).

Give it some thought and "paint a picture" and I'm sure teylyn, another E-E expert, or myself will be more than happy to get this over the line.  Please create several examples to get your thought across.

Cheers,

Dave
0

LVL 85

Expert Comment

ID: 36558627
It appears to me that you are basically trying to return and evaluate a formula string. Although this can be done (see attached file for one way; you could also use code) to me it implies a bad workbook design. I suspect that you ought to be using a template sheet instead or something along the lines of what Dave has suggested.

Regards,
Rory
vlookup-help.xlsm
0

LVL 50

Expert Comment

ID: 36558641
Will, I'm in New Zealand, too, so I feel the same drain pain of the day.

In your last sample you say

I want the result of the vlookup in B2 to reference E1 on this sheet.
The basic vlookup is working but the current result is looking at E1 on Sheet2.

I don't see how the "current result" of the vlookup is looking at E1 on Sheet 2 at all. There is no value in E1 on Sheet2.

In fact, the formula that I posted in my first comment will take E1 of the current sheet and combine it with the vlookup formula. Dave refined that formula to include only an exact match. The result is

=E1&VLOOKUP(A1,Sheet2!A1:B3,2,0)

Jim is good

If that's not what you want, you'll need to explain with more data and more details.

cheers, teylyn

0

Author Comment

ID: 36558989
Hi Guys

Sorry if I'm not being clear.

See the more detailed spreadsheet attached called vlookup-help3.xlsx.

It has examples of what I wanted to achieve.

Cheers,

Will vlookup-help3.xlsx
0

LVL 50

Accepted Solution

Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 2000 total points
ID: 36559061
Hello,

In the Master sheet, replace the text with this:

StudentName is good. StudentParticiple is working well in class. StudentName is good at Excel formulas.
StudentName is average

In the Student sheets, use this as the formula in column B, starting in B1

=SUBSTITUTE(SUBSTITUTE(VLOOKUP(A1,Master!\$A\$1:\$B\$3,2),"StudentName",\$E\$1),"StudentParticiple",\$E\$2)

see attached.

cheers, teylyn
vlookup-help3.xlsx
0

Author Closing Comment

ID: 36562758
Oooooh, now that is classy!!!  Using SUBSTITUTE makes my Master sheet much nicer and it keeps all the formula on the individual student's sheet.

Thanks so much!  It's exactly what I was trying to achieve.

Cheers,

Will
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
###### Suggested Courses
Course of the Month13 days, 18 hours left to enroll