106 points · by EntICOnc · 4y ago · 34 comments
Even the ancient built-in VBA IDE has better support.
Surely Excel formulas are the most commonly across the whole population of computer users?
On the other hand, you can see it as a feature. It forces you to keep your formulas short, break them down in helper columns and overall make your logic cleaner. If you are writing a 4 line long formula, you are doing something wrong. Sytax highlighting would still surely help, but it is not a replacement for clean modelling.
=CONCATENATE(
IF(A1<0;"-";"+");
TEXT(INT(ABS(A1));"00") ;"d";
IF((ABS(A1) - INT(ABS(A1)) - INT( (ABS(A1) - INT(ABS(A1)))*60 )/60) * 3600 > 59.5;
TEXT(INT((ABS(A1) - INT(ABS(A1)))*60)+1;"00");
TEXT(INT((ABS(A1) - INT(ABS(A1)))*60);"00")
);"m";
IF((ABS(A1) - INT(ABS(A1)) - INT( (ABS(A1) - INT(ABS(A1)))*60 )/60) * 3600 > 59.5;
TEXT(0;"00");
TEXT(ROUND( (ABS(A1)-INT(ABS(A1))-INT((ABS(A1)- INT(ABS(A1)))*60)/60)*3600;0 );"00")
);"s"
)
...which should take a value in cell A1 that is in the range [0,360) and return the value in angle notation (degrees, minutes and seconds). I especially wanted this function all in one cell to save loads of helper cells (the spreadsheet calculates the position of the moon, sun, planets and a physical ephemeris for each planet so a lot of angles to display).It is a pain to apply, I use a text editor to search and replace the cell reference for each angle. I'd settle for the formula bar display of the formula not reformatting the line breaks.
I'm not sure this works with LibreOffice though. Probably not.
I rapidly tried and I get something a bit shorter (about half the length), but my rounding ends up with imperfect precision and sometimes I get 10m60s rather than 11m0s due to it. Appropriate rounding at the appropriate points would fix that.
I assume you have tried the '$' signs to see if they will help?
I can't imagine how much time this one thing would have saved over my last 40 years of spreadsheeting.
[1] https://www.microsoft.com/en-us/garage/blog/2022/03/a-new-wa...
Maybe, but of developers who’ve installed an editor? And would go through copying formulas back and forth?
Surely at that point you’re using vba, or you’ve moved to scripting excel from the outside, or off of excel entirely?
MS should have provided a formulat parser and interpretter as a FOSS portable C lib decades ago. But at the time, they didn't pretend to be the good guys to win market shares, they publically despised anything open or free, so it couldn't happen.
I guess it would have help OOo a lot at the time, and would help pandas today.
Now that MS has VSCode, maybe they'll end up doing a LSP, but I doubt it. Programmers are not their target for excel.
Totally no pressure (although this is clearly a pitch), but if you get the chance to check it out and have feedback on where we fall short of being as awesome as Excel, your feedback would be super appreciated!
For example, =PI() displays at most 3.14159265358979, no matter how many digits I ask it to display. If I add 1.999E-15, I get 3.1415926535898. If I type 3.14159265358979 (omitting the invisible trailing 3), then add 1.999E-15, I get 3.14159265358979.
In other words, Excel uses double-precision floating point, but never displays more than fifteen significant figures. You may be in for a surprise if, say, you round trip a spreadsheet through CSV.
[0] https://en.wikipedia.org/wiki/Double-precision_floating-poin.... [1] https://www.mrexcel.com/excel-tips/17-or-15-digits-of-precis... [2] https://www.youtube.com/watch?v=WZfjmbEDbfI
edit: just making sure, don't be offended - https://docs.microsoft.com/en-us/office/vba/api/Excel.Range(...