Re: how to concatenate string to spreadsheet formula
On 2022-08-15 14:40, Fraga, Eric wrote: Hi Edgar, I did not quite understand what you actually were calculating but maybe consider the following expression for table formulas: #+TBLFM: $3='(format "%s\\textwidth" (/ (* 1.0 $2) $1));N If you specify ";N", the entries are treated as numbers. The problem with division is that if both numbers are integers, integer division is used so I multiply one of the arguments by 1.0 to ensure floating point numbers. HTH, eric Aha! Thank you very much. - This free account was provided by VFEmail.net - report spam to ab...@vfemail.net ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands! $24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!
Re: how to concatenate string to spreadsheet formula
Hi Edgar, I did not quite understand what you actually were calculating but maybe consider the following expression for table formulas: #+TBLFM: $3='(format "%s\\textwidth" (/ (* 1.0 $2) $1));N If you specify ";N", the entries are treated as numbers. The problem with division is that if both numbers are integers, integer division is used so I multiply one of the arguments by 1.0 to ensure floating point numbers. HTH, eric -- : Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50
how to concatenate string to spreadsheet formula
Dear everyone, At the moment, I am using an Org spreadsheet to concatenate a string to the ratio between 2 numbers. One of numbers is the [[sum-of-column][sum of a column]]. The other number would correspond to [[each-row-col1][each of the rows of another column]] ([[ratio-to-0.95][multiplied by a factor]]) 1. <>calculate the sum of a column - originally wanted vsum - corresponding part: =(reduce '+ (mapcar 'string-to-number (list @5$<..@6$<)))= 2. <>each of the values in column 1 (string-to-number $1) 3. <>the ratio between [[each-row-col1]] and [[sum-of-column]] is multiplied by 0.95 The final value is concatenated with "\\textwidth". | width | height | w / Σw | w / pic_row | | 204 |120 | 0.10418795 |0.32606557 | | 215 |125 | 0.10980592 |0.34364754 | | 191 |119 | 0.097548519 |0.30528689 | | 483 |125 | 0.24668029 | 0.7294912559614499\textwidth | | 146 |128 | 0.074565884 | 0.22050874403854998\textwidth | | 719 |101 | 0.36721144 | | |---++-+---| | 1958 |718 | | | #+tblfm: @5$4..@6$4='(concat (number-to-string (* 0.95 (string-to-number (math-format-number (math-div (string-to-number $1) (reduce '+ (mapcar 'string-to-number (list @5$<..@6$< "\\textwidth") Is there a more succint way of doing this? For instance, my original intention was to have something like #+tblfm: @5$4..@6$4=vsum($1 / vsum(@5$<..@6$<);"%0.4f\\textwidth" which does not work. I would also like to avoid creating another column (=#+tblfm: @5$4..@6$4=vsum($1 / vsum(@5$<..@6$<);%0.4f::@<<$5..@>>$5='(concat $4 "\\textwidth")=). Thank you very much! - This free account was provided by VFEmail.net - report spam to ab...@vfemail.net ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands! $24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!