簡體   English   中英

如何對存儲在單個單元格中的向量執行excel計算?

[英]How to perform an excel calculation on a vector that is stored in a single cell?

我有一個電子表格,每個單元格中都有一個數字矢量(例如{1; 2; 3; 4}),我想執行簡單的計算(例如= median(),= max(),(不涉及VBA))在每個向量上。 Excel以某種方式僅顯示和執行每個向量的第一個值並進行計算。

我如何才能獲得在計算中使用完整矢量的能力(以及可能在圖表中使用)?

我所擁有的:

Actual values in the cells           results in 
 +-A----------+-B----------+         +-A----------+-B----------+
1| ={1;2;3;4} | ={4;3;2;1} |        1|         1  |         4  |
 +------------+------------+         +------------+------------+
2| =median(a1)| =min(B1)   |        2|         1  |         4  |
 +------------+------------+         +------------+------------+

我想要的是:

 +-A----------+-B----------+  
2|        2,5 |         1  |  
 +------------+------------+

我沒有用的嘗試是以以下形式輸入值

1;2;3;4 // {1;2;3;4} each will not be excepted as numbers in the calculations

{={1;2;3;4}]} with String+Shift+Enter will be handled like a single number as well.

(1;2;3;4) // =1; 2; 3; 4 // =(1;2;3;4) each result in an error on input ("not a formula")

在A1中:

={1,2,33,4,5}  

(請勿使用Ctrl + Shift + Enter)

在B1中:

=MAX(eval(A1))   '>>> 33

UDF的“助手”功能:

Function eval(ByVal rng As Range)
    eval = Application.Evaluate(rng.Formula)
End Function

沒有VBA:

A1:  1;2;3;4

創建一個命名公式:

seq_99   Refers to:  =IF(ROW(INDEX($1:$65535,1,1):INDEX($1:$65535,255,1))=1,1,(ROW(INDEX($1:$65535,1,1):INDEX($1:$65535,255,1))-1)*99)

然后:

=MEDIAN(IFERROR(--TRIM(MID(SUBSTITUTE(A1,";",REPT(" ",99)),seq_99,99)),""))

在按住Enter鍵的同時按住Ctrl + shift鍵 輸入

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM