Bug 147024 - Inconsistent behavior of RIGHT() text function when separating names to Firstname & Lastname
Summary: Inconsistent behavior of RIGHT() text function when separating names to First...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4 all versions
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-27 18:11 UTC by Doug
Modified: 2022-01-27 18:34 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Test sheet demonstrating wrong behavior of CALC RIGHT() function. (15.60 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-01-27 18:11 UTC, Doug
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug 2022-01-27 18:11:06 UTC
Created attachment 177849 [details]
Test sheet demonstrating wrong behavior of CALC RIGHT() function.

I received a spreadsheet from a colleague in which Column A contained both the first and last names of individuals.  I needed to separate them into FirstName and LastName columns.

In order to separate them, I entered the formulas LEFT(A#,FIND(" ",A#))  and
RIGHT(A#,(FIND(" ",A#)-1)) where # is the actual row number.

The LEFT() function always works as expected.  Not so with RIGHT() function.  See the attached test sheet, especially rows 12-16.

This behavior also exists in Apache OpenOffice 4.6/4.10 and I found it on three different computers using either Windows 7 or Linux Mint 20.1/20.2.  AOO and LO are NOT simultaneously installed on any of these computers.  The computers are a mixture of DELL Latitude E6510 laptops and Optiplex 9010 desktops.
Comment 1 Doug 2022-01-27 18:19:07 UTC
I don't have earlier versions of LO or AOO available to test with.
Comment 2 m_a_riosv 2022-01-27 18:34:29 UTC
You are misunderstanding how RIGHT() works, please take a look to the help. https://help.libreoffice.org/latest/en-US/text/scalc/01/04060110.html?DbPAR=CALC#bm_id3149805

You can do it using right:
=RIGHT(A12;LEN(A12)-(FIND(" ";A12)))
or in your way with mid:
=MID(A12;FIND(" ";A12)+1;99)

Please in the future better find help in https://ask.libreoffice.org/c/english/5