Startseite » Excel EN » FILTERXML Function Excel – Extract Data from XML Instantly

FILTERXML Function Excel – Extract Data from XML Instantly

Want to extract structured data from an XML string directly into your spreadsheet? The FILTERXML function in Excel 🧩 lets you pull specific data points from XML-formatted content using XPath expressions. This makes it incredibly powerful for web scraping, API response parsing, and data transformation — and it’s compatible with Excel on Windows, Mac, and Ubuntu (via Excel Online or Office 365). 📥🧠

In this post, you’ll learn how FILTERXML() works, where it shines, how to write XPath queries, and how to use helpful keyboard shortcuts to boost your productivity.


🔍 What Is the FILTERXML Function?

Syntax:

=FILTERXML(xml, xpath)
  • xml: A valid XML string or reference to one.
  • xpath: An XPath query to extract nodes or values.

✅ Returns one or multiple values that match the XPath expression.


💡 Real-Life Example of FILTERXML

XML Data (in cell A1):

<items>
<item>
<name>Apple</name>
<price>1.25</price>
</item>
<item>
<name>Banana</name>
<price>0.75</price>
</item>
</items>

Extract the first item’s name:

=FILTERXML(A1, "//item[1]/name")

✅ Output: Apple

📦 Extract all prices:

=FILTERXML(A1, "//price")

🧠 Excel will spill the values into multiple cells if supported (Excel 365+).


⚙️ XPath Quick Tips

XPath QueryWhat It Does
//itemSelects all <item> nodes
//item[2]/pricePrice of the second item
//nameAll name values in the XML
//item/nameNames under each <item>

📘 XPath is case-sensitive and space-sensitive — type carefully!


📊 Use Cases for FILTERXML in Excel

IndustryApplication
FinanceExtracting market data from XML feeds
E-commerceParsing product info from API responses
EducationTeaching structured data and XPath basics
Data ScienceCleaning and transforming web-sourced data
MarketingPulling lead or form data from CRM exports

🌐 Especially useful when used with WEBSERVICE() for live data queries (Windows-only).


⌨️ Keyboard Shortcuts for FILTERXML Usage

ActionWindows/LinuxmacOS
Start formula input==
Auto-complete FILTERXMLType FILTERXML + TabSame on Mac
Enter formulaEnterReturn
Copy formula downCtrl + DCmd + D
Function dialog boxShift + F3Fn + Shift + F3

💻 Combine with TEXTJOIN, CONCAT, or INDEX to manage multi-node outputs.


🧪 Combining FILTERXML with Other Functions

Function ComboExamplePurpose
WEBSERVICE + FILTERXML=FILTERXML(WEBSERVICE("url"), "//tag")Extract data directly from a live XML URL
TEXTJOIN=TEXTJOIN(", ", TRUE, FILTERXML(A1, "//name"))Combine multiple node values into one cell
INDEX=INDEX(FILTERXML(A1, "//item/name"), 2)Return a specific item from a list
IFERROR=IFERROR(FILTERXML(A1, "//wrong"), "Not Found")Handle missing or invalid XPath queries

🧠 Use IFERROR() to clean up unpredictable XML inputs.


⚠️ FILTERXML Limitations

  • ❌ Not available in Excel for Mac (older than Office 365)
  • ❌ Doesn’t support non-well-formed XML
  • ❌ Cannot parse JSON (use Power Query or scripts instead)
  • Only works in Windows Excel versions (except in Excel Online for Mac/Linux)

🔐 Ensure that XML strings are clean, closed, and correctly nested.


📱 Compatibility: FILTERXML on Desktop, Web & Mobile

PlatformSupport
Windows (Excel 365)✅ Full Support
macOS (Excel 365)⚠️ Limited (Online only)
Ubuntu/Linux (via web)✅ Excel Online
Excel Mobile❌ Not Supported

📌 Best used on Excel 365 desktop or online with XML sources from APIs or exported tools.


💬 FAQs About Excel FILTERXML Function

What does the FILTERXML function do in Excel?
It parses an XML string and extracts values using XPath expressions.

Can FILTERXML be used with live web data?
Yes — combine with WEBSERVICE() on Excel for Windows.

Does FILTERXML support JSON?
No — it only works with valid XML. Use Power Query or scripts for JSON.

Can FILTERXML return multiple values?
Yes, and in Excel 365, it spills results into adjacent cells.

Why is FILTERXML returning #VALUE!?
The XML might be malformed, or the XPath expression is invalid.

Is FILTERXML available on Mac?
Not natively — but it works in Excel Online or via Office 365.


🟢 Final Thoughts: FILTERXML Function Excel

The FILTERXML function in Excel 🧩 is a powerful tool for anyone dealing with structured data. Whether you’re pulling product info from APIs, extracting pricing from supplier files, or working with web-sourced XML feeds, FILTERXML() helps you parse and analyze data directly in your workbook. Add in a little XPath magic and you’ve got a seriously versatile formula!

Complete List of Windows Keyboard Shortcuts

If you need help for Windows, you can find a whole list of all keyboard shortcuts here.

https://keyboard-shortcuts.org/

Advertisment