ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   vlookup and filename returning same result on each sheet. (https://www.excelbanter.com/excel-discussion-misc-queries/18656-vlookup-filename-returning-same-result-each-sheet.html)

RogueSwan

vlookup and filename returning same result on each sheet.
 
Hi,

This is my first post with this group even though I have used a lot of
the postings to solve my problems, thanks.

My problem is this:

I have a workbook with about 40 sheets in it. Each sheet name is also
a reference number. I use this reference number is a vlookup formula
as follows

=VLOOKUP(VALUE(MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)),List!$A$3:$G$70,COLUMN ()+1,FALSE)

The problem I have with this is that each sheet has the same result.
Say I look at sheet 25, if I do a recalc then the correct answer comes
through the formula. If I then move to sheet 33 it has the same
results as sheet 25 until I do a recalc. This unfortunately then
changes sheet 25's result to the same as sheet 33. What am I missing?

JE McGimpsey

You need to include the second argument in the CELL() function - by
default it uses the last sheet calculated. Try:

=VLOOKUP(VALUE(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,25
5)),List!$A$3:$G$70,COLUMN()+1,FALSE)



In article ,
(RogueSwan) wrote:

The problem I have with this is that each sheet has the same result.
Say I look at sheet 25, if I do a recalc then the correct answer comes
through the formula. If I then move to sheet 33 it has the same
results as sheet 25 until I do a recalc. This unfortunately then
changes sheet 25's result to the same as sheet 33. What am I missing?


RogueSwan

Thanks for the reply, I realised about five minutes after I posted
that needed the second argument.


JE McGimpsey wrote in message ...
You need to include the second argument in the CELL() function - by
default it uses the last sheet calculated. Try:

=VLOOKUP(VALUE(MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,25
5)),List!$A$3:$G$70,COLUMN()+1,FALSE)



In article ,
(RogueSwan) wrote:

The problem I have with this is that each sheet has the same result.
Say I look at sheet 25, if I do a recalc then the correct answer comes
through the formula. If I then move to sheet 33 it has the same
results as sheet 25 until I do a recalc. This unfortunately then
changes sheet 25's result to the same as sheet 33. What am I missing?


JE McGimpsey

next time you might consider posting a reply to your own article, then.
My post came more than an hour after yours...

In article ,
(RogueSwan) wrote:

Thanks for the reply, I realised about five minutes after I posted
that needed the second argument.




All times are GMT +1. The time now is 11:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com