回復 30# sistinechapel
Assuming your date in text format of d/m/yyyy stored in cell A1, using date() function, the
parameters of date() are year, month and day. So the first part of value(right()) is to
extract the year part from the string in A1 (i.e. "2012") and change it to number
(i.e. value("2012")). The second part is to extract the month from the string stored in A1 by
using mid() and search() functions. Mid() is to extract the month from the string which
requires 3 parameters. 1st is the location of the string (i.e. A1). 2nd is the starting position
which is the position after the first "/". 3rd parameter is the length of the string which
is calculated by finding the last position of the string (i.e. the last position of "/") minus
the starting position. Finally the 3rd parameter of date() is day which is first 1 or 2 digit
of the string stored in A1 which can be found by using search().
You can try using each function separately to see the intermediate result. |