# Subtraction of history

Hi, I have an Excel file as follows, which contains a number of rows and columns.
Each line contains a date
I want to compare the dates between the rows and insert the result in the opposite cell.
The sample file is as follows.
a.xlsx (9.0 KB)

1. Ensure that the dates are in the KNIME date format
2. Use the Date&Time Difference node to compute the difference to the previous row

HI elsamuel
Is it possible to say node name?

@alex1368, which node are you referring to?

HI @ elsamuel
Date and time difference node to calculate the difference with the previous row

I guess I don’t really understand what you’re asking. I gave the name of the node, it’s Date&Time Difference.

Hi @alex1368 ,

Your explanation does not really tell what you want to do. Surely comparing the dates is probably the means to do that, but what exactly are we comparing for? Is it to check which of the 2 dates are valid? Is it to check which of the 2 dates are newer? Is it to check which of the 2 dates is the first day of the month? Of the week? Of the Year? Is it to check which of the 2 dates is closer to the first day of the month? Of the week? Of the Year?

Fortunately, you showed what the results look like, and it would seem you want to know the difference in days between the 2 dates. Even calculating the difference between the 2 dates could be done in days, months, years, minutes, seconds. We can’t guess what you want.

As I keep repeating this “the more accurate you are in your details, the more accurate the solution will be”.

Something like this should do:

Input:

Result:

Here’s the workflow: Get number of days between dates of current and previous row.knwf (19.5 KB)

FYI, the result you compiled manually in your Excel sheet has some mistakes there.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.