Age diff

Hey guys

Need some help pls, i have to calculate in my excel for example from age 67 to date 21.10.2010 how old that pers had, and put all this in my uipath work, i have 22 of them dates in my excel to calculate, how can i put them all in a formula?

Hi
If possible can we have a sample excel so that we could come up with a xaml
Cheers @poana

test.xlsx (11.4 KB) so the first age is 67 and the column E and under the rest of 22 ages and in the column B you have tha data from where i have to calculate age that was then.

1 Like

Great
but I m still not clear with this…sorry for that
can you give us a sample calculation on this
Cheers @poana

That is my point, i didn t do no calculation, i don t get the formula how it works on 22 persons with different ages to calculate how old they were in the dates from Column B in my excel.

Hi @poana

You want to add ages to their corresponding dates, right ?

New Date —> 21.10.2077
likewise you want it on all 22 rows, correct me if i’m wrong.

for this, ReadRange to get data from excel into DataTable and you’ve to use For Each Row
(for each row In DT(output variable of read range))loop, in that loop you need to add following sequence of activities.

  1. Assign —> Date1Str (String) = row(1).ToString —> by this you’ll get date in string format.
  2. Assign —> Date1 (DateTime) = Datetime.ParseExact(Date1Str,“dd.MM.yyyy”,System.Globalization.CultureInfo.InvariantCulture) —> by this datestring converted into DateTime variable.
  3. Assign Age (Int32) = CInt(row(4).ToString) —> get age from datatable.
  4. Assign NewDate (DateTime) = Date1.AddYears(Age) —> by this age (years) adds on date.
    OR
  5. If you want to Minus years from date then, use this—> Date1.AddYears(-Age)

here I’m attaching xaml, If you need it. Age.zip (20.7 KB)