Bug 96338 - Format Cell Fractions by eights and 16ths or arbitrary list of denominators
Summary: Format Cell Fractions by eights and 16ths or arbitrary list of denominators
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: All All
: medium enhancement
Assignee: AaronPeterson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-08 13:07 UTC by AaronPeterson
Modified: 2016-05-02 20:38 UTC (History)
2 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 AaronPeterson 2015-12-08 13:07:40 UTC
I'm creating a spreadsheet for some carpentry related tasks.

I'll have to do some more work to strip off the whole numbers and round...

but this:
=IF(0=MOD(C5,16)," ",IF(0=MOD(C5,8),"1/2",IF(0=MOD(C5,4),CONCATENATE(4-MOD(C5/4,4),"/4"),IF(0=MOD(C5,2),CONCATENATE(8-MOD(C5/2,8),"/8"),CONCATENATE(16-MOD(C5,16),"/16")))))

gives me the fractional part if I divide by 16 and do an INT()

The fraction function gives useless 10ths as the denominator.

Excel has an option to choose 16ths or 8ths, but it is evil because it shows 8/16ths when it should show 1/2

So I propose a format where we can give a list of possible denominators.
2,4,8,16,32  would be a common such list... and would basically be ran thru a function like what I wrote up there...

but if someone wanted to have 3,9,12,14    or 1,2,3,5,7,11,13,17  as a list, they could get the nearest fraction.


Performance could get challenging with long lists, but there should be some way to cache the formated answers, etc.

11 5/17



Really, this would enable this tool to interface with CAD software better where designs are already in inches.


I'm happy to work on this project if there is some guidance, or at the next hackathon in Seattle.
Comment 1 AaronPeterson 2015-12-08 13:09:06 UTC
There is also expectation to be compatible with Excel, even though it has annoying behavior.
Comment 2 V Stuart Foote 2015-12-08 22:56:40 UTC
@Aaron,

Well sure, you're welcome to work on this. But do you envision trying to push this down into edit engine as a calc data format, with GUI on top--or might you be happier working this out as a macro based extension in your language of choice.

Also, note that you've taken this for development. If that is not your intent, just edit the "Assigned to" field.

Of course this has kicked around for quite some time within the OpenOffice world. Maybe check out some of the history to decide how deep you want to dive in.

https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=43964

and a similar macro based extension for Excel has been round for years: http://www.josh.com/InchCalc/index.htm  might be worth porting if you're inclined.

Stuart
Comment 3 Laurent Balland 2016-05-02 20:38:11 UTC
Actually, you can force denominator with number format such as
# ?/16

And it IS compatible with Excel fraction.