Calc airithmetic snafu

Hi,

Using LO 7.2.2.2 Calc on iMac 11.6.1(Big Sur).

I have a data column that ends in alphabetic letters i.e.

C      |  D
2| 2.4 km|    2.4
3| 4.8 km|    4.8

As the ' km' can't be added in column C, I used the LEFT formula to only extract the first 3 digits, namely =LEFT(C2,3). This works wonderfully in column D, BUT whilst not shown on the spreadsheet, the numbers are shown in-between double quotes if one looks at the formula, in column D, with the Function Wizard, which again does not enable the number to be added, averaged etc.

Both C, D columns are formatted as Number with a single decimal point and there will be no -ve number.

What am I missing, and where to rectify it?

Regards
Hylton

Left will return a string so convert to a number using value... Something like this

=Value(left(....))

⁣Get BlueMail for Android ​

HI ANDREW,

Left will return a string so convert to a number using value... Something like this

=Value(left(....))

THANK YOU Works as expected,now on to the next formula Challenge

Re: Units out of the data.

1. The formula =Value(Left(C1,Find(" ",C1))) will be insensitive to
longer--129.4 km-- or less specific--7 km-- distances.

2. When I remove units from a list, usually I'm working a large amount of
data and find that the whole spreadsheet works better when source data like
this isn't the result of formula. That is, it doesn't take so long to
refresh when I'm only waiting on 10,000 calculations, and not 10,000,000
calculations.

So to avoid those annoying long refresh times, instead of creating the
source data with formula I copy the column to a new one, ensure there are
adequate new columns behind it, then convert the column to data with "Data
-> Text to Columns" and choose to break on space only (in your case,
sometimes I have to list out the first letter of units, but then I lose the
units, so instead I find/replace the new column to introduce tab characters
before doing the text to column action. (And if you trust yourself to
recognize mistakes in the text to columns steps before "undo" is gone,
copying the column to another one isn't required.)

3.

Greetings,

If you do not like adding columns, you could do the following:

1) Select everything (CTRL-A)
2) Do a search & replace to remove all the "km" indications. This
should also convert the entry in the cells to numbers at the same time.
3) Keeping what is still selected, go to Cell > Format (CTRL-1), and
set the number format to User defined with the format as # ##0.0" km".
This will have your numbers displayed with the proper units.

I hope this helps.
Rémy.

Or perhaps leave the actual number in the first column and just use a cell format for the "km".

i.e.

1) Leave 2.4 in the cell
2) ctrl+1 (cmd+1 mac) to open format cell
3) then in the Format Code type " km" behind the number format.

And now your 2.4 will show "2.4 km" in the cell.

And you can do your arithmetical calculations on the cell as you've only changed the visual number format.

:slight_smile:

B.