Saturday 15 February 2014

Substracting time values in Excel XML -



Substracting time values in Excel XML -

i'm trying substract 2 times , obtain value in hours.

hurdles:

it seem need specify total date, cannot utilize time? in example, if utilize total date (ie. 2014-08-22t08:30:00), in excel see "41875.35" in cell instead of date

here current markup:

<?xml version="1.0"?> <ss:workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <ss:worksheet ss:name="sheet1"> <ss:table> <ss:row> <ss:cell> <ss:data ss:type="datetime">08:30:00</ss:data> </ss:cell> </ss:row> <ss:row> <ss:cell> <ss:data ss:type="datetime">17:30:00</ss:data> </ss:cell> </ss:row> <ss:row> <ss:cell ss:formula="=int((r[-1]c-r[-2]c)*24)"></ss:cell> </ss:row> </ss:table> </ss:worksheet> </ss:workbook>

errors i'm getting:

xml error in table reason: bad value file: c:\timediff.xml.xls group: cell tag: info value: 08:30:00 xml error in table reason: bad value file: c:\timediff.xml.xls group: cell tag: info value: 17:30:00

update #1

latest cut:

<?xml version="1.0"?> <ss:workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <ss:worksheet ss:name="sheet1"> <ss:table> <ss:row> <ss:cell> <ss:data ss:type="string">08:30</ss:data> </ss:cell> </ss:row> <ss:row> <ss:cell> <ss:data ss:type="string">17:30</ss:data> </ss:cell> </ss:row> <ss:row> <ss:cell ss:formula="=round((timevalue(r[-1]c) - timevalue(r[-2]c)) *24, 1)"></ss:cell> </ss:row> </ss:table> </ss:worksheet> </ss:workbook>

problem persists 1 time in excel, changing 08:30 08:15, formula indicate error: #value!.

final solution:

ss:formula="=round( ((r[-1]c-r[-2]c) * 24) - 0.5, 3)

xml excel

No comments:

Post a Comment