Bug 117002 - ISNUMBER is treating the value provided by LEFT as text instead of as a number.
Summary: ISNUMBER is treating the value provided by LEFT as text instead of as a number.
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.4.5.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-13 23:09 UTC by simm.emanem
Modified: 2018-04-14 15:36 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simm.emanem 2018-04-13 23:09:35 UTC
The ISNUMBER function is not recognizing a number when it is obtained through another function, or at least through LEFT().
I need to know whether a string of text starts with a number, or not, and so I used =ISNUMBER(LEFT(G6)).

The value of G6 is "2aaa"
The result of =Left(G6) is 2.


=ISNUMBER(LEFT(G6))  results in FALSE.

It should show TRUE. 

Also, copying and pasting the cell containing the function using Paste Only > Text results in 2 being displayed in the cell.

But copying and pasting using Paste Only > Number option results in a blank cell.

I am pretty sure that the problem is with ISNUMBER, because if I add a number to the result of  LEFT, I get a correct sum:   =LEFT(G6)+1 equals 3.

ISNUMBER is treating the value provided by LEFT as text instead of as a number.
Comment 1 simm.emanem 2018-04-13 23:46:53 UTC
The result of =LEFT(G6) is '2, not 2. I used  VALUE(LEFT(G6)) to ensure that the result is 2, not '2. 

=ISNUMBER(VALUE(LEFT(DG6))) is 2.
Comment 2 MM 2018-04-14 00:36:42 UTC
The outcome looks fully correct here. Left() is outputting character[s] (text) instead of values, so Isnumber will always be false when given this as input. https://help.libreoffice.org/Calc/Text_Functions#LEFT
Comment 3 m_a_riosv 2018-04-14 15:36:12 UTC
(In reply to simm.emanem from comment #0)
> .............
> I am pretty sure that the problem is with ISNUMBER, because if I add a
> number to the result of  LEFT, I get a correct sum:   =LEFT(G6)+1 equals 3.
> 
> ISNUMBER is treating the value provided by LEFT as text instead of as a
> number.
Because there is an automatic conversion out of LEFT() that gives an string, the + operation makes the conversion.

An easy way to have it working is involve the LEFT() with N() function N(LEFT()), or doing an operation forcing the conversion LEFT()+0.

https://help.libreoffice.org/6.0/en-US/text/scalc/01/04060104.html?System=WIN&DbPAR=CALC#bm_id3153786
N 
Returns the numeric value of the given parameter. Returns 0 if parameter is text or FALSE.
If an error occurs the function returns the error value.
Syntax
N(Value)
Value is the parameter to be converted into a number. N() returns the numeric value if it can. It returns the logical values TRUE and FALSE as 1 and 0 respectively. It returns text as 0.