emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to concatenate string to spreadsheet formula


From: edgar
Subject: how to concatenate string to spreadsheet formula
Date: Mon, 15 Aug 2022 13:50:59 +0000
User-agent: Horde Application Framework 5

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. <<sum-of-column>>calculate the sum of a column
   - originally wanted vsum
- corresponding part: =(reduce '+ (mapcar 'string-to-number (list @5$<..@6$<)))=
2. <<each-row-col1>>each of the values in column 1
   (string-to-number $1)
3. <<ratio-to-0.95>>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 abuse@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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]