Oct 18 2023 08:44 AM
Hi All,
I have a series of data in an excel column:
30021
3205.1
3205.2
254444455
225541225
Is it possible, using a formula, to extract all the digits from the left up to the "."?
The result should be:
30021
3205
3205
254444455
225541225
Thank you so much,
Oct 18 2023 08:56 AM
Oct 18 2023 12:03 PM
Thanks but when I have, for example, 565.1 it works. When I have 565.1 it gives an error, since the first takes it as decimals due to the language configuration of my laptop, the second (when there is a "." it does not take it as decimal).
Oct 18 2023 12:09 PM
Oct 18 2023 01:28 PM
Oct 18 2023 01:50 PM
Oct 18 2023 03:05 PM
SolutionThe terms with the embedded character that is not a decimal separator (radix) could be separated using
= NUMBERVALUE(TEXTBEFORE(data, ".",,,1))
where the final 1 ensures that, in the absence of the separator, the entire string is returned. The integer part of numbers with a decimal separator could then be returned using INT.
= INT(NUMBERVALUE(TEXTBEFORE(data, ".",,,1)))
Alternatively you could test to distinguish numbers from text strings and apply different rules according to the case.
= IF(ISNUMBER(data),
INT(data),
NUMBERVALUE(TEXTBEFORE(data, "."))
)
Oct 18 2023 03:14 PM
Afterthought:
If you have the misfortune to be using a version of Excel other than 365 (or maybe 2021), you would need to use LEFT and either trap the errors or test the data
= INT(IFERROR(LEFT(data, SEARCH(".", data) - 1), data))
Oct 18 2023 03:21 PM
Oct 18 2023 03:28 PM
Oct 18 2023 03:42 PM
Oct 18 2023 03:05 PM
SolutionThe terms with the embedded character that is not a decimal separator (radix) could be separated using
= NUMBERVALUE(TEXTBEFORE(data, ".",,,1))
where the final 1 ensures that, in the absence of the separator, the entire string is returned. The integer part of numbers with a decimal separator could then be returned using INT.
= INT(NUMBERVALUE(TEXTBEFORE(data, ".",,,1)))
Alternatively you could test to distinguish numbers from text strings and apply different rules according to the case.
= IF(ISNUMBER(data),
INT(data),
NUMBERVALUE(TEXTBEFORE(data, "."))
)