vendredi 23 septembre 2016

UDF or standard IF function for date range?

I am trying to create a range from numbers in a column, and create a range. For example, column F: 1899, 1912, 1915, 1918, 1929, 1934, 1935, 1936... So as soon as 1934, 1935, 1936 sequence starts, it would capture 1934 and iterate through until the difference isn't 1. The result for this example would be 1934 - 1936. Once I create these date ranges, I would use text to columns by the "-" delimiter to create begin and end date columns. The difficulty in this is comparing another column and making sure the dates are based on a particular title. So: IF(Title 1 = Title 2, (IF date 2 - date 1 = 1, increment to check date 3 - date 2 = 1, otherwise = date 1)). I could try to nest many IF statements, but that would get nasty, plus no idea how many dates to compare per title.

Iteration seems like it would be much easier by creating a sub or UDF in VBA, but I haven't found any examples on here (or elsewhere) that may be helpful.

Aucun commentaire:

Enregistrer un commentaire