Hi ,
I need to make a workflow for anniversary automation.
In this we will be having an excel sheet containing the name and date of the person.
First we will compare the date from the excel with the present day date and than if there is the date present than we will subtract and find the year difference for the same .
If the Year difference is of 5 years than need to send the message and if the date current date does not match with any date present than send message as No date found.
Also we need to get the data because we need to add the name of the person and the year difference in the message .
Example =
KJ - 28/01/2019
If this date is there than the current date is matching than the year difference must be 5 Years today so need to send the message in this case.
Here I have provided the excel sheet containing the data needed.
DifferenceDate.xlsx (10.3 KB)
Can anyone help me for the above provided information??
Thanks in advance!!
Hello @Kunal_Jain
Kindly Find the xaml file, you may get some idea.
forum_datedifference.zip (148.3 KB)
Butt why it is giving for yesterdays date
Kunal is Under 5 years of date 01/27/2019 00:00:00
This is wrong output
We need to get the date for today as an example I have given that is 28/01 for today
You have used CDate function but the error is why it is taking 27/01 as a difference of 5 years
Here I have updated the sheet with the date for you
DifferenceDate.xlsx (10.3 KB)
@Kunal_Jain ,
Could you please provide your expected output?
Do you need to get the current date, and not consider the year?
@Gokul_Jayakumar
The Input is 27/01/2019 than according to today the output will be 5 years and 1 day
which is wrong output (According to human calculation)
But it is giving the output as “KJ is Under 5 years of date 01/27/2019 00:00:00” which is wrong.
Consider the Input as 28/01/2019 than according to today the output will be 5 years only which is correct.
I need this output because we will wish the anniversary to the person on the day of his anniversary not a day before or after.
The output that we are getting is wrong as if we calculate on any date time calculator.
Also, I have tried it for 10 years also,
And for 2018 why are we getting this output
DEF is Under 10 years of date 01/28/2018 00:00:00DEF is Under 10 years of date 01/28/2018 00:00:00
Hi Kunal,
So, As per my understanding
if the input is 28-01-2019
And Current Date is 28-01-2023
Then (28-01-2023 - 5 years) = 28-01-2018
so 28-01-2019 >28-01-2018
Here the -5 years of the current date is 28-01-2018 and your input is 27-01-2019, that’s why it is showing as this “KJ is Under 5 years of date 01/27/2019 00:00:00”
Regards,
Firoz Rangrez
But I am not getting the required output
According to my requirements I need to check the date from the excel sheet and the date when the Bot runs or the current date to match and than check the difference of year if it is exactly the 5 years difference than need to send the wishes or if the difference is exactly 10 years than need to send the different wishes. But in this scenario exact means if the date in excel sheet is 30/01/2019 and current date is 30/01/2023 than the difference is exactly of 5 years in this case we need to send the message.
And also same for the 10 years differnce.
Hi @Kunal_Jain,
I think the difference between 30/01/2019 and 30/01/2023 is 4 years not exactly 5 years.
30/01/2018 will be the 5 years.
and if you want exactly 5 years then in the code which is shared by @Gokul_Jayakumar there is a > condition change it to =
Then it will give you an exact match.
Regards,
Firoz
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.