You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Sheets:根据指定列名查找对应列的最后数值

Get the Last Numeric Value from Your Target Column

Nice work using MATCH to nail down the column index—let's build on that formula to pull the last numeric value from the column you're targeting. Here are a couple of solid methods depending on your Excel version:

Method 1: Compatible with All Excel Versions

Combine INDEX and LOOKUP to reliably find the last numeric entry, even if there are blank cells in the column:

=INDEX($H:$AZ, LOOKUP(9^9, INDEX($H:$AZ,,MATCH(B2,$H$1:$AZ$1,0)), ROW($H:$AZ)), MATCH(B2,$H$1:$AZ$1,0))

What this does:

  • INDEX($H:$AZ,,MATCH(B2,$H$1:$AZ$1,0)): Uses your existing MATCH result to isolate the entire target column (the double commas mean we're specifying the column index, not the row).
  • LOOKUP(9^9, [target column], ROW($H:$AZ)): 9^9 is a huge number that will land on the last numeric value in the column, returning its row number.
  • The outer INDEX then uses that row number and your column index to pull the final value you need.

Method 2: Simplified for Excel 365/2021 (Dynamic Arrays)

If you have access to XLOOKUP (available in newer Excel versions), this is a cleaner approach that searches from the bottom up:

=XLOOKUP(TRUE, INDEX($H:$AZ,,MATCH(B2,$H$1:$AZ$1,0))<>"", INDEX($H:$AZ,,MATCH(B2,$H$1:$AZ$1,0)), "", 0, 2)

What this does:

  • INDEX($H:$AZ,,MATCH(B2,$H$1:$AZ$1,0)): Again, isolates your target column.
  • XLOOKUP(TRUE, [target column]<>"", [target column], "", 0, 2): Looks for the last non-empty cell (which works for numeric values) by starting at the bottom of the column (the final 2 sets the search direction to "bottom to top").

Quick Tips:

  • If you know your data doesn't go beyond row 1000 (for example), replace $H:$AZ with $H$2:$AZ$1000 to speed up the formula (full-column references can be slower).
  • Both methods skip blank cells and target the last actual numeric value, regardless of gaps in your data.

内容的提问来源于stack exchange,提问作者Michael

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:35:10