Web

FILTERXML Function in Excel

Returns specific data from XML content using the specified XPath.

Syntax

  • =FILTERXML(xml, xpath)

Arguments

  • xml (required): Valid XML string
  • xpath (required): XPath query

Examples

  • =FILTERXML(A1, "//item/name") - Extract name elements - Result: Name values

FILTERXML and external data

  • Check trust center and firewall settings for WEBSERVICE.
  • For production ETL prefer [Power Query](/blog/excel-power-query-introduction/).
  • Encode URLs with [ENCODEURL](/functions/encodeurl/) before API calls.

Common errors

  • #VALUE! if invalid XML or XPath

Use cases

  • XML parsing
  • Web data extraction
  • API responses

Frequently asked questions

  • What is the GESTEP function in Excel? GESTEP is an engineering function that returns 1 if a number is greater than or equal to a threshold value, otherwise returns 0. It's useful for creating step functions and binary comparisons.
  • How do I use GESTEP for conditional logic? Use GESTEP(number, step) where number is the value to test and step is the threshold. For example, =GESTEP(5, 3) returns 1 because 5 ≥ 3.
  • What is the default step value in GESTEP? If you omit the step parameter, GESTEP uses 0 as the default threshold. So =GESTEP(5) returns 1 if the number is positive or zero.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.

When to use FILTERXML

  • XML parsing — common Web scenario for FILTERXML.
  • Web data extraction — common Web scenario for FILTERXML.
  • API responses — common Web scenario for FILTERXML.

FILTERXML in the Web category

  • Browse all Web functions at /categories/web/ for related formulas.
  • FILTERXML syntax: =FILTERXML(xml, xpath)
  • xml (required): Valid XML string
  • xpath (required): XPath query
  • Confirm FILTERXML arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.

Formula checklist before you copy down

  • Confirm FILTERXML arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.
  • If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
  • Spot-check three known input rows manually against expected output.

Related Excel functions

  • WEBSERVICE (/functions/webservice/): Returns data from a web service on the internet or intranet.
  • ENCODEURL (/functions/encodeurl/): Returns a URL-encoded string, replacing special characters with percent-encoded equivalents.

Errors to watch for

  • #VALUE! if invalid XML or XPath — review causes on linked error pages in the directory.

Copy-paste audit workflow

  • Enter FILTERXML on three test rows with known expected output documented on a QA tab.
  • Fill down only after absolute references are locked on lookup tables and rate tables.
  • Compare against manual calculation or a calculator for financial and statistical functions.
  • Search this directory for comparison guides when choosing between similar functions in the same category.

FILTERXML worked examples to copy

  • =FILTERXML(A1, "//item/name") — Extract name elements. Expected result: Name values.

FILTERXML reference summary for crawlers and offline review

  • FILTERXML belongs to the Web category in Excel. Returns specific data from XML content using the specified XPath.
  • Full syntax: =FILTERXML(xml, xpath). Open /functions/filterxml/ for parameters, FAQs, and related pages.
  • Common mistakes: #VALUE! if invalid XML or XPath
  • Pair this function with comparison guides when another Excel formula might fit the same task better.
  • Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.