Showing the last value in a column in a named table?

Smokeyham

Board Regular
Joined
Feb 1, 2006
Messages
120
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was thinking this would be quite simple to do, but after a couple of hours of research I still have not seemed to solve it.

I am trying to show the last value in a specified column from a named table. The result will be in a new table which has transposed the column headings into row headings.

The source data is in a table named "CurrentNW". As an example, one column in the source data is labelled "CapitalOne." New row entries start with a date in left hand column (don't know if that is significant or not).

I have tried Index, Xlookup, and Take - All without success.

I am using Office 365.

Thanks for any help.
Gordon



Microsoft® Excel® for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 32-bit
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello @Smokeyham could you provide a sample? That would make things much easier for me.
A screenshot of a table (filled manually) that shows the source and result data.
 
Upvote 0
Not sure what you'll be doing with the value once you've got it, but here's both a formula & VBA possibility for you to consider:
Book1
ABCDEFGH
1
2HDR1HDR2HDR3CapitalOneHDR5HDR6
31datadatadata1data
42datadatadata1data
51datadatadata1data
62datadatadata1data
71datadataThis item1data
8
9This item
10
Sheet1
Cell Formulas
RangeFormula
B9B9=INDEX(CurrentNW,COUNTA(CurrentNW[[#All],[HDR1]])-1,MATCH("CapitalOne",CurrentNW[#Headers],0))


VBA Code:
Sub Test()
    Dim tbl As ListObject, rng As Range
    Set tbl = ActiveSheet.ListObjects("CurrentNW")
    Set rng = tbl.DataBodyRange(tbl.DataBodyRange.Rows.Count, _
    Application.Match("CapitalOne", tbl.HeaderRowRange, 0))
    
    MsgBox rng.Value
    rng.Select
End Sub
 
Upvote 0
Since you mentioned trying XLookup, this should work:

Excel Formula:
=XLOOKUP(TRUE,CurrentNW[CapitalOne]<>"",CurrentNW[CapitalOne],,,-1)
 
Upvote 0
The source data is in a table named "CurrentNW". As an example, one column in the source data is labelled "CapitalOne." New row entries start with a date in left hand column (don't know if that is significant or not).

I have tried Index, Xlookup, and Take - All without success.
What happens with:

Excel Formula:
=TAKE(CurrentNW[CapitalOne],-1)
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,976
Members
449,095
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top