Bug 106151 - Add a new CELL() function for Excel compatibility
Summary: Add a new CELL() function for Excel compatibility
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 145048 163780 (view as bug list)
Depends on:
Blocks: Missed-Excel-Functions
  Show dependency treegraph
 
Reported: 2017-02-23 10:07 UTC by GerardF
Modified: 2025-05-11 08:14 UTC (History)
7 users (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 GerardF 2017-02-23 10:07:15 UTC
Help for CELL function in LibreOffice :
"Reference (list of options) is the position of the cell to be examined. If Reference is a range, the cell moves to the top left of the range. If Reference is missing, LibreOffice Calc uses the position of the cell in which this formula is located. Microsoft Excel uses the reference of the cell in which the cursor is positioned."

OASIS specification :
"R : if R is a reference to a cell, it is the cell whose information will be returned; if R is a reference to a range, the top-left cell in the range is the selected one; if R is omitted, the current cell is used."

My poor english does not allow me to know if the specifications are met.
What is the meaning of "Current cell"?
Cell where is the formula or active cell...

If we keep CELL how it works in LO and AOO, it should be good to have a new CELL.XL for compatibility.
Comment 1 m_a_riosv 2017-02-23 23:03:20 UTC
I think LibreOffice help information it's clear

https://help.libreoffice.org/index.php?title=Calc/Information_Functions&Language=en-US&System=WIN&Version=5.4#bm_id3159412
"
Reference (list of options) is the position of the cell to be examined. If Reference is a range, the cell moves to the top left of the range. If Reference is missing, LibreOffice Calc uses the position of the cell in which this formula is located. Microsoft Excel uses the reference of the cell in which the cursor is positioned.
"

BTW on the top it's possible select the language.
Comment 2 Carlos 2017-04-03 18:15:38 UTC
(In reply to m.a.riosv from comment #1)
> I think LibreOffice help information it's clear
> 
> https://help.libreoffice.org/index.php?title=Calc/
> Information_Functions&Language=en-US&System=WIN&Version=5.4#bm_id3159412
> "
> Reference (list of options) is the position of the cell to be examined. If
> Reference is a range, the cell moves to the top left of the range. If
> Reference is missing, LibreOffice Calc uses the position of the cell in
> which this formula is located. Microsoft Excel uses the reference of the
> cell in which the cursor is positioned.
> "
> 
> BTW on the top it's possible select the language.

LibreOffice help is clear. But GerardF is correct that the function is not 100% compatible with MS Excel. 

By the way the current MS Excel help 
http://web.archive.org/web/20170403173356/https://support.office.com/en-us/article/CELL-function-51BD39A5-F338-4DBE-A33F-955D67C2B2CF?ui=en-US&rs=en-US&ad=US
states that if the reference is missing, the CELL function uses the reference for "the last cell that was changed".
Comment 3 QA Administrators 2019-01-21 03:39:46 UTC Comment hidden (obsolete)
Comment 4 hardcoder 2019-08-12 15:07:35 UTC
In fact Excel help isn't precise about what happens when the second parameter isn't given. Despite not documented, Ms is aware of that behavior and didn't change it with time; instead, it was replicated in Excel Online and Excel Mobile (for Windows). Others are aware of the behavior too, besides LibreOffice Help. In WPS Office, CELL function works the same way.

Although I don't think this is the best place for such functionality, I'd be one more to ask for LibreOffice to implement it the way Excel did, as you didn't invent the function, and you support .xls and .xslx formats.

That feature can be useful for user interaction without requiring macros. (Functions are way more cross-platform and straightforward than macros in an additional language, which often defeats the purpose of choosing spreadsheet.) For example, the user can select a cell in a large table and get extra info about that value, or via conditional formatting, similar values can be highlighted (this works in Excel 2010 and Excel Online).
Comment 5 hardcoder 2019-08-12 15:19:19 UTC
That said, it would be even better to _also_ have a function just for returning the selected range reference -- and this time, it would expose the whole range, not just one cell. Also it would return the reference, like some other functions are able to use. (CELL, instead, can return the address only as a string, not directly as reference.)

Together with that, there could be per-file options on when to recalc, including when selection changes, and at fixed intervals. This last one already can be done by adding a dummy data connection ("link to external data..."). I guess it's better to leave this for a new bug report and replicate these suggestions there.
Comment 6 hardcoder 2019-08-13 03:19:53 UTC
(In reply to hardcoder from comment #4)
> [...] in Excel Online and Excel Mobile (for Windows).
(I have never used Excel for Mac or Android.)

> besides LibreOffice Help. In WPS Office, CELL function works the same way.
Works the same as MS Excel.

> Although I don't think this is the best place for such functionality, I'd be
> one more to ask for LibreOffice to implement it the way Excel did, as you
In my opinion, this behavior should be put in the very CELL function, not an additional one.
Comment 7 hardcoder 2020-09-20 01:06:27 UTC
Just in case they haven't read about this old problem, I'm throwing a NEW status. Fell free to revert this once the newer comments are considered.
Comment 8 m_a_riosv 2021-10-11 08:50:00 UTC
*** Bug 145048 has been marked as a duplicate of this bug. ***
Comment 9 Mike Kaganski 2024-11-06 11:08:25 UTC
Current revision of MS help on CELL is quite clear, and tells about "cell selected at the time of calculation":

https://support.microsoft.com/en-us/office/cell-function-51bd39a5-f338-4dbe-a33f-955d67c2b2cf
Comment 10 m_a_riosv 2024-11-06 11:52:53 UTC
*** Bug 163780 has been marked as a duplicate of this bug. ***
Comment 11 Colin 2025-05-11 07:45:33 UTC
I believe this misalignment between Excel and LO CALC regarding the CELL("row") function presents a serious usability and compatibility issue. In Excel, CELL("row") returns the row number of the last active cell, enabling dynamic calculations and concatenation with other critical information. However, CALC deviates from this behaviour, instead returning the row number of the cell containing the function call—an outcome that serves little practical purpose and undermines Excel's long-established functionality.
This discrepancy is more than a minor inconvenience—it negates a feature that has existed in Excel since Excel 4, long before OASIS specifications took shape. While standardization is valuable, should it come at the cost of legacy functionality that has been in use for decades? Excel predates OASIS by nearly 20 years, meaning CALC’s rigid adherence to the specification disregards important historical functionality.
A pragmatic approach would be to either:
    1. Align CALC's implementation of CELL("row") with Excel’s behaviour for continuity and usability. 
    2. Introduce an alternative function—such as EXCELL() or EX.CELL()—to ensure Excel-based spreadsheets retain their intended functionality when imported into CALC. 
Additionally, the current state of macros in CALC compounds the issue, as they lack the ability to preserve the undo stack—a critical oversight that leads to irreversible actions rather than safe experimentation AND implementation.
While standardisation matters, preserving the usability of long-standing functions should take precedence over rigid adherence to specifications that fail to account for established practices. It’s time to reconsider this implementation before valuable functionality is lost for good.
The "me too" moment - it has prevented me from coaxing a potential user from Excel to LO because there is no practical workaround - like YOU, I can count the global number of users who didn't go "Oh Heck, NO, UNDO" on the fingers on the tail of a Doberman..
Comment 12 Mike Kaganski 2025-05-11 08:14:39 UTC
Regina: what is your take, does the OOXML wording contradict the compatibility with existing Excel functionality (i.e., does that "if R is omitted, the current cell is used" means "current" to be "the cell with the CELL formula"), or maybe it's under-defined, and so allows adjusting to meet Excel?