+ Reply to Thread
Results 1 to 9 of 9

VLookup Multiple Sheets - along single row across 52 sheets

  1. #1
    Registered User
    Join Date
    09-21-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2003
    Posts
    8

    VLookup Multiple Sheets - along single row across 52 sheets

    Afternoon all....

    I'm attempting to create a management tool in the style of a 'database' and I'm using excel - I should probably have learnt access but I am where I am ~ and I love Excel.

    Basically from two input sheets (where staff and job details are entered) I've managed to create a series of 52 weekly sheets to display the hours that each staff memebr will spend on each job over the next 52 weeks - when it's live etc...

    I now want to creata a summary sheet that will look to the relevant sheet i.e. sheets W(1) to W(52) and return the number of hours by week of each staff member (regardless of which scheme they are working on) i.e. a staff usability by week calculator.

    I've tried using a couple of different UDFs from forums, that scan each sheet looking for the date in question within a defined cell range across multiple sheets, but they are failing... Possibly because the dates are not unique to just the sheets I wish to search, although they are unique to the cell range I'm specifying?!?
    For info they are:
    VLOOKAllSheets(Look_Value As Variant, Tble_Array As Range, Col_num as Integer, Optional Range_look as Boolean)
    MultVlookup(FindThis As Variant, LookIn As Range, SheetRange As String,OffsetColumn As Integer)

    I've also attempted an INDIRECT command which I extracted from elsewhere, which refers to the sheet and cell range I wish to perform my VLOOKUP on i.e.:
    =VLOOKUP(A2,INDIRECT(A1),3,FALSE)
    Where A2 is the date I'm looking at, A1 is the "sheet:cell" reference in text format: i.e. W(12)!$C$6:$Z$6, and I'd like the 3rd column of this 1 row vlookup range returning... but still no joy.

    Can anyone out there give me a hand with this one please?
    I'm begging before something goes pop in my head!!
    Cheers
    Poolio

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Keep all your data on one worksheet and you'll find working with it a great deal easier. If you were doing it in Access you wouldn't have 52 tables holding the same type of data, the theory is the same with good spreadsheet design.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    09-21-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Dom, thanks for the tip, normally I would try to keep everything together, but my lists will increase (unprecitably in length over time), so I wouldn't know where to stop one and start the next ~ although thinking abuot it with 65,000 lines to play with I think I'd probably have enough room!
    JP

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    It can be done with formula like this: https://sites.google.com/a/madrocket...ions/3d-lookup

    The problem with using INDIRECT is it's a volatile function and can effect the performance of your workbook.

    The general rule is if you can't hold all your main data on one worksheet then Excel probably isn't the right tool for the job.

    Dom

  5. #5
    Registered User
    Join Date
    09-21-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Dom,
    Thanks for your super-prompt help thus far... but I just can't get the INDIRECT function to bring up the sheet name..?!? I think I'm copying the explanation exactly that you sent the link for - I've started from a blank workbook, and I'm using Ctrl+Shift+Enter...

    {=INDEX(MySheets, MATCH(1, COUNTIF(INDIRECT("'" & MySheets & "'!A1:A50"), A3), 0))}

    Any idea what I could be doing wrong - I'm using 2003...

  6. #6
    Registered User
    Join Date
    09-21-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Scratch that - I'd somehow defined MySheets twice - it works - it's a MEEERACLE!!
    Gawd Bless you Dom - magical!
    JP

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Cool, glad you got it sussed.

    Dom

  8. #8
    Registered User
    Join Date
    09-21-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    Dom,
    Decided to heed you advice and instead of having 52 (+8) worksheets I now have 9.
    Managed to script the cells to repeat the same table (with a varying date for lookup purposes) every 100 rows, which is easy enought to expand to every 200 / 1000 / n rows....
    However I now find that my workbook has ballooned from a podgy 7.5MB to a rather unhealthy 13.3MB!
    I even managed to trim down all of my longer formulae (the INDEX / MATCH / INDIRECT CTRL+SHIFT+ENTER ones that scanned all 52 sheets) to a much tidier VLOOKUP C:C option....

    I've experienced this in the past and found that I had a load of apparently blank (but not-blank) cells which were like some kind of file-size expanding anti-matter, a collegue calls these duffs and wrote the following code to erase them...

    Sub RemoveDuffs()
    Dim LastRow As Long, LastCol As Integer, cell As Range

    LastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
    LastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column

    For Each cell In Range(Cells(1, 1), Cells(LastRow, LastCol))
    If IsEmpty(cell) = False And Len(cell) = 0 Then cell.Clear
    Next cell

    End Sub


    I've tried that but still the file is a whopper!
    Could it be the mutiple references across the sheets causing this Excel obesity...?!

    JP

  9. #9
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VLookup Multiple Sheets - along single row across 52 sheets

    I've heard of this as a method for reducing file bloat...

    Click 'Save' and 'Save As...' a web page. Then exit Excel, reopen Excel, and use 'Open' to open the html workbook (despite being an HTML file, it'll have an Excel icon), and 'Save As...' an xls file again. Close Excel again, and have a look at the file size.

    Dom

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1