+ Reply to Thread
Results 1 to 10 of 10

Use indirect function to get last cell value in a column on another sheet

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Use indirect function to get last cell value in a column on another sheet

    Hello, I can't seem to figure out the syntax of this formula:

    =LOOKUP(2,1/INDIRECT("'"&A2&"'!"&B1&":"&B1&"<>"""),INDIRECT("'"&A2&"'!"&B1&":"&B1))

    where A2 has the tab name, B1 has the column letter. Can someone please help?

    thanks!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: Use indirect function to get last cell value in a column on another sheet

    There would seem to be a missing quote at the end:

    =LOOKUP(2,1/INDIRECT("'"&A2&"'!"&B1&":"&B1&"<>"""),INDIRECT("'"&A2&"'!"&B1&":"&B1"))

    Which version of Excel do you have?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Use indirect function to get last cell value in a column on another sheet

    Hi AliGW, I have excel 2016. I don't think it is missing a "" at the end (if I add it I won't even be able to enter it), as it is I got #REF error, I think the problematic part is probably the <>"" part. thanks for your help.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: Use indirect function to get last cell value in a column on another sheet

    OK - please update your forum profile first.

    Then see if this works:

    =LOOKUP(2,1/INDIRECT("'"&A2&"'!"&B1&":"&B1&"<>""""),INDIRECT("'"&A2&"'!"&B1&":"&B1))

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,426

    Re: Use indirect function to get last cell value in a column on another sheet

    What do you want the formula to do? The syntax looks entirely incorrect for any possible application. So, to fix it I need to know what you WANT it to do. Preferably, attach a small sample sheet (5 rows) with manually calculated answer... no need for a formula.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Use indirect function to get last cell value in a column on another sheet

    I'm trying to directly pull the last value of a column on a different sheet. on Sheet2, the formula without indirect function looks like this:
    =LOOKUP(2,1/(Sheet1!D:D<>""),Sheet1!D:D) and it works

    where now I have "Sheet1" in cell A2 on Sheet2, "D" in cell B1 on Sheet2

    I could have the formula on each sheet, but just want to see how the syntax should be.

    thanks!
    Attached Files Attached Files
    Last edited by lynnsong986; 07-15-2021 at 01:00 PM.

  7. #7
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Use indirect function to get last cell value in a column on another sheet

    attach the updated workbook with the working formula beside the wrong formula
    Attached Files Attached Files

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,426

    Re: Use indirect function to get last cell value in a column on another sheet

    =LOOKUP(2,1/(INDIRECT("'"&A2&"'!"&B1&":"&B1)<>""),INDIRECT("'"&A2&"'!"&B1&":"&B1))

    It is a bad idea to use a volatile function (INDIRECT) with whole column references. Rvery time anything changes it recalculates all 1,000,000 rows.

    Use this instead:
    =LOOKUP(2,1/(INDIRECT("'"&A2&"'!"&B1&"1:"&B1&"100")<>""),INDIRECT("'"&A2&"'!"&B1&"1:"&B1&"100"))

    which runs from D1 to D100.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Use indirect function to get last cell value in a column on another sheet

    thank you sooooooooooo much Glenn, this is awesome!!

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,426

    Re: Use indirect function to get last cell value in a column on another sheet

    You're welcome & thanks for the feedback.

+ 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. Indirect Sheet reference with cell reference left function and text
    By teststrip in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-01-2015, 10:31 AM
  2. Replies: 4
    Last Post: 12-28-2014, 02:43 PM
  3. Replies: 2
    Last Post: 10-05-2014, 04:10 PM
  4. Sumif function using indirect function and data from different sheet
    By pronky007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2013, 12:40 PM
  5. Sum of indirect sheet names with multiple cells (SUM, INDIRECT,SHEETNAME in cell)
    By a1b2c3d4e5f6g7h8 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-12-2013, 08:42 AM
  6. Replies: 7
    Last Post: 11-12-2010, 10:58 AM
  7. indirect function to reference cell on different sheet
    By Dolemite in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 09-06-2005, 07:05 PM

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