Function Problems

Use XLOOKUP in Excel to Return the Latest Nonblank Vaccination Value

Steven ParkerSteven Parker Dec 2, 2026 868 views

Question details

Find the latest date with a nonblank, nonzero vaccination percentage for a country and return that percentage.

Use XLOOKUP in Excel to Return the Latest Nonblank Vaccination Value
Product
Microsoft Excel
Device & OS
not provided
Scenario
A table contains countries, dates, and vaccination percentages, and the user wants the latest qualifying value for a selected country.
Observed behavior
The desired result is the numeric vaccination percentage associated with the latest qualifying date, or a message when no qualifying record exists.
Before you start

Confirm that Table1 has columns named date, location, and people_fully_vaccinated_per_hundred, and enter the country to search for in A6. Make sure dates and percentages are stored as numbers and that your Excel version supports LET, FILTER, and XLOOKUP.

Solution 1Recommended

Find the latest nonzero value with XLOOKUP and FILTER

Use this formula when records may be unsorted and blank or zero percentages should be excluded.

The formula filters for the selected country, numeric dates, and numeric nonzero percentages. It finds the maximum qualifying date, then returns a matching percentage.

1
Select the result cell

Click B6, or another empty cell where you want to display the percentage for the country in A6.

2
Enter the formula

Enter =LET(d,Table1[date],v,Table1[people_fully_vaccinated_per_hundred],c,Table1[location],ok,(c=$A6)*ISNUMBER(d)*ISNUMBER(v)*(v<>0),IF(SUM(ok)=0,"No data",XLOOKUP(1,ok*(d=MAX(FILTER(d,ok))),v,"No data"))) and press Enter.

3
Apply it to other countries

Drag the fill handle from B6 down alongside other country names in column A. Adjust the table and column references if your workbook uses different names.

Find the latest nonzero value with XLOOKUP and FILTER
Duplicate dates: If a country has multiple qualifying records on its latest date, XLOOKUP returns the first matching record in the table.
Work with spreadsheet formulas

Find the latest vaccination value in WPS Spreadsheet

Open your workbook in WPS Spreadsheet and use the same lookup approach to return the latest qualifying vaccination percentage, provided your version supports the required functions and table references.

  1. 1. Open the workbook: In WPS Spreadsheet, select Open and choose your Excel workbook.
  2. 2. Check the data: Confirm that A6 contains a country and that Table1 has the date, location, and people_fully_vaccinated_per_hundred columns.
  3. 3. Enter the lookup: Click B6 and enter =LET(d,Table1[date],v,Table1[people_fully_vaccinated_per_hundred],c,Table1[location],ok,(c=$A6)*ISNUMBER(d)*ISNUMBER(v)*(v<>0),IF(SUM(ok)=0,"No data",XLOOKUP(1,ok*(d=MAX(FILTER(d,ok))),v,"No data"))).
  4. 4. Check and save the result: Press Enter and verify the returned value against the source table. If the formula works in your version, use File > Save As to save the workbook in XLSX format.
Find the latest nonzero vaccination value without sorting the recordsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interface for country-by-country analysisWork with formulas in a free office suite
QA img-9

Frequently Asked Questions

Does the formula require the dates to be sorted?

No. MAX(FILTER(...)) finds the latest qualifying date regardless of the order of rows in Table1.

Why does the formula return No data?

No data means the formula found no row for the country in A6 with a numeric date and a numeric nonzero percentage. Check the country name and the values in the date and vaccination columns.

Does ISNUMBER alone exclude zero percentages?

No. Zero is numeric, so the formula also uses v<>0 to exclude it. Remove that condition if zero is a valid result for your analysis.

What if Excel does not recognize XLOOKUP or FILTER?

Check whether your Excel version supports LET, FILTER, and XLOOKUP. If it does not, use a version that supports them or build an alternative with functions available in your version.