Hi,
Based on your example, it seems that you have read this tutorial:
XML[
^].
I'm guessing that your desired output could be something like this:
<data-set>
<records-by-last-name>
<lastname>Smith</lastname>
<records>
<record>
<sales>16753</sales>
<country>UK</country>
<quarter>Qtr 3</quarter>
</record>
<record>
<sales>18919</sales>
<country>USA</country>
<quarter>Qtr 3</quarter>
</record>
<record>
<sales>9698</sales>
<country>USA</country>
<quarter>Qtr 1</quarter>
</record>
</records>
</records-by-last-name>
<records-by-last-name>
<lastname>Williams</lastname>
<records>
<record>
<sales>14867</sales>
<country>USA</country>
<quarter>Qtr 3</quarter>
</record>
<record>
<sales>19302</sales>
<country>UK</country>
<quarter>Qtr 4</quarter>
</record>
</records>
</records-by-last-name>
</data-set>
This XML document could be imported into
MS Excel. However, you won't be able to export the data to XML file in such structure using
Export XML Data...
In order to import or export XML document, you need to add an XML map. If specified XML source doesn't refer to a schema (for example, as in my example above),
MS Excel will create a schema based on the XML.
Note that the XML schema describes the structure of the XML document.
MS Excel has some XML limitations. The attempt to export the data using this XML schema should end up with the following error message: "Cannot save or export XML data. The XML maps in this workbook are not exportable.". "Verify Map for Export..." would give more information about the error. In this case, it's because XML map contains list of lists and a mapped element's relationship with other elements cannot be preserved (
MS Excel can't handle with it).
In conclusion, I doubt there is an easy way to do what you want (unless you actually need something else). However, if you want to export data using some complex XML structure, you could write VBA code to build the XML document from your data...