• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to extract last entry in a column from another sheet using Index, Match?

Hello,

Attached is an example. Sheet 1 is a checkbook register and budget. Columns B through G are checkbook register. Columns I through AJ are the funding categories. Column H sums the Balance for each category (BAL_GAS+BAL_HOU+BAL_INS....etc) to make sure the category balances align with the checkbook balance in Column G.

I've created Sheet 2 so I can see a simple summary of the balance for each budget item. For example, I would like to see what my balance is for gas money, etc.

In my mind, I need to do an Index/Match to match the Column Headers on Sheet 1, with the Column Header names listed on Sheet 2 in Column B. Once these match, then I need to extract the last entry of that column.

Thank you in advance for your help!
 

Attachments

  • Book1.xlsx
    18.8 KB · Views: 11
Like this? Right-click the new table and choose Refresh.
 

Attachments

  • Chandoo452225Book1.xlsx
    28.5 KB · Views: 11
When I click refresh, I get an error message:
Initialization of the data source failed.
Check the database server or contact your database administrator. Make sure the external database is available, and then try the operation again. If you see this message again, create a new data source to connect to the database.
I don't see any formulas.
 
Ahh.
It's Power Query, see:
Install Power Query With Excel 2013 | MyExcelOnline

Download Microsoft Power Query for Excel from Official Microsoft Download Center

The first link has an annoying popup which covers the screen but this can be dismissed with the Esc key on the keyboard.
 
Try,

1] In "Sheet1", please change B5 from : "Cell Phone - Check #1003" to "Utilities - Cell Phone - Check #1003"

Then,

2] In "Sheet2" D2 formula copied down :

=OFFSET(Sheet1!H$1,MATCH(A2&"*",Sheet1!$B$2:$B$9,0),INDEX({4,8,12,16,20,24,28},ROW(A1)))

71815
 

Attachments

  • OFFSET.xlsx
    19.3 KB · Views: 5
Please try at D2

=INDEX(Table2,MATCH(A2&"*",Sheet1!$B$2:$B$9,),MATCH(LEFT(A2,3)&"*",Table2[#Headers],)+3)
 

Attachments

  • Book1.xlsx
    20.7 KB · Views: 6
Bosco_Yip and Excel Wizard,
Both of your formulas worked perfectly on the example workbook. When I tried to use the formulas in the 'real' workbook, no luck and I think I may have figured out why. On the attached updated example.

Sheet 1 Column A = Checkbook register
I don't want the formula to reference this column because entries are not consistent, e.g., Gas could also be Speedway, Sunoco, etc.

Sheet 2 Column A = Budget Items
I created this column just as a 'long-hand' version of Column B.
Sheet 2 Column B = Balance Col (Balance Columns)
This column needs to be referenced in the formula. These terms are consistent. As mentioned before, I feel I need an Index Match to pair up the items on Sheet 2 Column B with headers on Sheet 1 Row 1. Once the match is true, then find the last entry in the matching column on Sheet 1.

I REALLY appreciate your help and level of expertise!
 

Attachments

  • Index Match Then Last Entry in Column.xlsx
    19.4 KB · Views: 4
In D2 of Sheet2:
Code:
=OFFSET(Table2[[#Headers],[CHECK REGISTER]],ROWS(Table2),MATCH([@[BALANCE COL]],Table2[#Headers],0)-1)
or non volatile and fulfilling the title of this thread:
Code:
=INDEX(Table2,ROWS(Table2),MATCH([@[BALANCE COL]],Table2[#Headers],0))
In your version of Excel, you may need to commit the formula to the sheet using Ctrl+Shift+Enter rather than just Enter then copy down, or you might need to select the whole of D2:E8 and enter the formula in all those cells at once using Ctrl+Shift+Enter. I can't test here.
 
Last edited:
You seem to have hard-wired column K into your formula. I have added an XLOOKUP formula and a MATCH/INDEX. I didn't bother to search for the last record because you are using a table and all the formulas run to the final record of the table.
Code:
= INDEX( Accounts,
    ROWS(Accounts),
    MATCH([@[BALANCE COL]], Accounts[#Headers], 0 )
  )
Looks familiar :)
 

Attachments

  • Index Match Then Last Entry in Column.xlsx
    21.8 KB · Views: 4
Last edited:
p45cal: In your formula, does the "8" represent offset 8 rows down? If so, then row "8" is the last row on the sample Sheet 1. My confidential worksheet keeps growing, I'm up to more than 3,400 rows and it grows weekly. How can we make the offset dynamic? Because I got the formula to finally work, but I had to change "8" to "3445", which is the last row of my data.
 
Last edited:
Please try

=LOOKUP(9^9,INDEX(Table2,,MATCH(B2,Table2[#Headers],)))
 

Attachments

  • Index Match Then Last Entry in Column.xlsx
    20.8 KB · Views: 9
Back
Top