+ Reply to Thread
Results 1 to 4 of 4

getting value from other sheet with name defined by cell-content?

  1. #1
    Registered User
    Join Date
    09-30-2016
    Location
    Munich, Germany
    MS-Off Ver
    2013
    Posts
    17

    Question getting value from other sheet with name defined by cell-content?

    Hello all,

    I am looking for a way to get data from the last row in a certain column on another sheet, where the sheet is defined based on a cell-content.
    I was looking at LOOKUP and INDIRECT which principally do what I need, however when I need to "point" to a different sheet then things fall apart.

    Situation:
    - Workbook with three sheets:
    a) Sheet1: "Overview"
    b) Sheet2: "1_Moadll"
    In Column B I have values, last one e.g. in row 5, e.g. content = "XYZ"
    c) Sheet3: "5_John"
    In Column B I have values, last one e.g. in row 8, e.g. content = "ABC"

    - Sheet "Overview" has a the number and the name listed, e.g.
    A1: 1, B1: Moadll
    A2: 5, B2: John

    - In Sheet "Overview" I need to get the values
    C1: get content "XYZ" from Sheet "1_Moadll" and cell B5
    C2: get content "ABC" from Sheet "5_John" and cell B8

    What I tried up to now:
    a) Overview, Cells C1: =INDIRECT(A1 & "_" & B1 & "!B5")
    => gets "XYZ", however this is static

    b) Sheet "1_Moadll", cell A1: =LOOKUP(2,1/(B:B<>""),ROW(B:B))
    => gets the row-number of the last entry, here e.g. 5

    c) Combine a) and b)
    - LOOKUP on each sheet in a certain cell
    - INDIRECT to that cell on "OVERVIEW"
    - LOOKUP using the content of that result
    C1: =INDIRECT(A1 & "_" & B1 & "!A1") ' A1 contains the value of the last row
    D1: = INDIRECT(A1 & "_" & B1 &"!B"&C1) ' pulls the right value

    d) incorporate LOOKUP into INDIRECT:
    "Overview", Cell E1: =INDIRECT(A1 & "_" & B1 &"!B"&LOOKUP(2,1/('1_Moadll'!B:B<>""),ROW(' & A1 & "_" & B1 & '!B:B)))
    => this also gets the right value, however requires the name of the sheet "1_Moadll" as a string in the lookup-call. Building that up inside the function does not point to the sheet anymore:
    =INDIRECT(A1 & "_" & B1 &"!B"&LOOKUP(2,1/("'" & A1 & "_" & B1 &"'!" &B:B<>""),ROW(' & A1 & "_" & B1 & '!B:B)))

    Any ideas on how to get that with appropriate functions.

    I am capable of VBA and using that getting the values would be a piece of cake. However here I am constrained to work without VBA.

    Thanks a lot already in advance!

    Moadll

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,598

    Re: getting value from other sheet with name defined by cell-content?

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    09-30-2016
    Location
    Munich, Germany
    MS-Off Ver
    2013
    Posts
    17

    Re: getting value from other sheet with name defined by cell-content?

    Hello,

    just uploaded at test-workbook with the various combinations that I tried.
    Column J is the most dynamic version, however this one unfortunately does not yield a "proper" result.

    Cheers

    Moadll
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: getting value from other sheet with name defined by cell-content?

    See if this would work for your purposes.
    1) Convert the ranges to tables. I prefixed the sheet names with tbl_ to produce the table names (i.e. tbl_1_Moadll)
    *This eliminates the need to count rows of cells in the column. Test by expanding tbl_1_Moadll (select cell C5, press tab key) and putting a value in B6.
    2) The last value in the Data1 column is retrieved using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to copy from one sheet and paste to another sheet defined by cell value
    By bryans88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2015, 02:09 PM
  2. [SOLVED] read single cell content from sheet of closed file and put it in a cell on an active sheet
    By rsmith5413 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2014, 04:16 AM
  3. [SOLVED] filter a sheet by column content, create new sheet with value in filtered cell
    By Footley in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-27-2012, 08:33 PM
  4. [SOLVED] If cell X's content in Sheet A equals to cell Y's content in Sheet B, Then copy some data.
    By sunheroj in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-09-2012, 09:25 AM
  5. Copy defined cell from various worksheets to new sheet (Index sheet)
    By kookao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2011, 03:55 PM
  6. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2006, 08:33 AM
  7. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 10:33 AM

Tags for this Thread

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