Conditional Number Formats that only can match negative numbers shouldn't display the sign #2573

Open
opened 2020-09-23 17:37:57 +00:00 by snoopyjc · 2 comments
snoopyjc commented 2020-09-23 17:37:57 +00:00 (Migrated from github.com)

In excel, if you have a number format, with a [condition], and that condition can only match negative numbers, then the sign of the value is suppressed. SSF.format incorrectly gives the sign. For example:

SSF.format('[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', -25)

gives -25 instead of 25.

In excel, if you have a number format, with a [condition], and that condition can only match negative numbers, then the sign of the value is suppressed. SSF.format incorrectly gives the sign. For example: SSF.format('[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General', -25) gives -25 instead of 25.
snoopyjc commented 2020-09-23 17:44:03 +00:00 (Migrated from github.com)

The test case in oddities.json line 153 is also incorrect.

The test case in oddities.json line 153 is also incorrect.
reviewher commented 2022-04-06 01:34:35 +00:00 (Migrated from github.com)

Using format [Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General in Excel 2019:
A

Using format [Red][<=0]General;[Blue][>=25]General;[Green]General;[Yellow]General in Excel 2019:

B
Using format `[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General` in Excel 2019: <img width="106" alt="A" src="https://user-images.githubusercontent.com/24845478/161877662-a4fd67ae-e390-47d9-8f10-56eedfb93672.png"> Using format `[Red][<=0]General;[Blue][>=25]General;[Green]General;[Yellow]General` in Excel 2019: <img width="108" alt="B" src="https://user-images.githubusercontent.com/24845478/161877856-c7097e1e-478e-4e40-a9a7-67b87a32beef.png">
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2573
No description provided.