+ Reply to Thread
Results 1 to 17 of 17

Formula to return a cell contents of the last row of a table

  1. #1
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Question Formula to return a cell contents of the last row of a table

    Good Afternoon,

    I'm after a formula which I think (and hope) is quite simple:

    It just needs to return the text contents of a cell that is in the last row of a Query table. The query updates every minute so the table could and will get bigger. I'm after the 3rd cell in from the left, on the last row of the table.

    Hope you understand

    Thanks

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    Clarify....

    Do you want the value of the absolute last row of the table?
    Or do you want the last value that appears in the table (not necessarily in the last row of the table)
    I.E.
    If there are blanks at the bottom of the table

    A1 = x
    A2 = y
    A3 = empty

    do you want the empty or the y ?

  3. #3
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    I want the y but there won't be any blank rows. Or there certainly shouldn't be

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    Try

    =LOOKUP(REPT("Z",255),A1:A100)

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Formula to return a cell contents of the last row of a table

    you can probably use counta() to find the last non-blank row, and then build that into an index/match using indirect()
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    Do I replace the A1:A100 with the query?

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    Replace A1:A100 with whatever represents the column you want to find the last text value in.

    Here's an example using a basic table

    =LOOKUP(REPT("z",255),TableName[HeaderName])

  8. #8
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    Thanks that works, although I have another small problem. When making the formula, and I select the relevant table column by using the small black arrow just above the table header, it inserts "Sheet1!C1:C40", which is the space that that row of the table occupies currently. However when the query expands adding new data, the selection stays at "Sheet1!C1:C40", so it doesn't include the new data. What I really need is to be to get it to say "TableName[Header Name], so that the selection expands along with the table.

    Any ideas? Thanks for the help so far

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    Is the table 'really' a table?

    Select any cell within the 'table'
    Go the Insert Tab, and insert table.

  10. #10
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    Yep the table button is greyed out. And a tab up the top appears with 'Design' on it

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    What happens if you manually type the tablename[headername] ?
    Does it stay, or get replaced by the range reference?

  12. #12
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    Sorry, just found out - I think it's only the LOOKUP formula that it doesn't like. I just tried a VLOOKUP and it was fine.

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    That's odd..
    But as long as you have solution

  14. #14
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    But I don't............the VLOOKUP was just a dummy formula to see if it accepted the right table reference

  15. #15
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    Can you attach your file?
    cleaned of personal info, and reduced in size, we only need 10 or 20 rows of data to work with.

  16. #16
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Formula to return a cell contents of the last row of a table

    For some unexplained reason it now works..........thanks very much..have some rep

  17. #17
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to return a cell contents of the last row of a table

    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. Replies: 0
    Last Post: 11-16-2012, 11:42 AM
  2. formula to return the ACTIVE cell's contents
    By bcn1988 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-31-2012, 10:50 AM
  3. Replies: 4
    Last Post: 03-19-2012, 03:05 PM
  4. Replies: 1
    Last Post: 03-19-2012, 09:43 AM
  5. [SOLVED] Formula to return cell contents based on multiple conditions
    By Bill in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-19-2005, 06:06 AM

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