最近想用EXCEL做一種功能,可輸入譬如
A+A+A=C , B+B+C=D , B+C+C=F , 前三項可選擇變換,得出想要的結果
想請問EXCEL有沒有辦法做到呢?
若無法,請提供其他程式的參考範例
五元一次
我是學生,我沒錢...零元可不可以?
她沒有E
總裁怎麼知道她沒有"E"?
真的是五元啦,ABCD+F,雖然ET,只跑了E,但還是有五個阿!
cdfu提到:
全都是等式,怎麼決策呀??
student提到:
A+A+A=C , B+B+C=D , B+C+C=F
student提到:
類似決策樹的功能...
用排列組合的方式處理
看看可不可以
結果如上圖
公式如下
<pre class="c" name="code">
A6=INDEX($B$1:$D$1,1,MOD(INT((ROW(A1)-1)/(3*3)),3)+1)
B6=INDEX($B$2:$D$2,1,MOD(INT((ROW(A1)-1)/(3)),3)+1)
C6=INDEX($B$3:$D$3,1,MOD(INT((ROW(A1)-1)/(1)),3)+1)
D6=SUM(A6:C6)
列7至列32均由列6公式**「向下拉」**而得
用MySQL作點另外的例子,不是運算的.
<pre class="c" name="code">CREATE TABLE ithelp040120a(
id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
arole CHAR(10) NOT NULL
);
INSERT INTO ithelp040120a(arole) VALUES
('白萬劍'), ('石破天'), ('兔牙妹'), ('泰大');
CREATE TABLE ithelp040120b(
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
roleid TINYINT UNSIGNED NOT NULL,
skill CHAR(10) NOT NULL
);
INSERT INTO ithelp040120b(roleid, skill) VALUES
(1, '蒼松迎客'),
(1, '梅雪爭春'),
(1, '明駝西來'),
(1, '風沙莽莽'),
(1, '月色昏黃'),
(1, '暗香疏影'),
(2, '開門揖盜'),
(2, '梅雪逢夏'),
(2, '千鈞壓駝'),
(2, '大海沉沙'),
(2, '赤日炎炎'),
(2, '鮑魚之肆'),
(3, '制服誘惑'),
(3, '黑絲誘惑'),
(4, '猛虎硬爬山'),
(4, '驚天爆橘拳');
CREATE TABLE ithelp040120c(
id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
aid TINYINT UNSIGNED NOT NULL,
askill TINYINT UNSIGNED NOT NULL,
bid TINYINT UNSIGNED NOT NULL,
bskill TINYINT UNSIGNED NOT NULL
);
INSERT INTO ithelp040120c(aid, askill, bid, bskill) VALUES
(1, 1, 2, 7),
(1, 2, 2, 8),
(1, 3, 2, 9),
(1, 4, 2, 10),
(1, 5, 2, 11),
(1, 6, 2, 12),
(3, 13, 4, 15),
(3, 14, 4, 16);
SELECT CONCAT('當'
, r1.arole
, '使出'
, s1.skill
, '時,'
, r2.arole
, '以'
, s2.skill
, '對應!') AS '對戰結果'
FROM ithelp040120c v
JOIN ithelp040120a r1
ON v.aid = r1.id
JOIN ithelp040120a r2
ON v.bid = r2.id
JOIN ithelp040120b s1
ON v.askill = s1.id
JOIN ithelp040120b s2
ON v.bskill = s2.id;
+-------------------------------------------------------------------+
| 對戰結果 |
+-------------------------------------------------------------------+
| 當白萬劍使出蒼松迎客時,石破天以開門揖盜對應! |
| 當白萬劍使出梅雪爭春時,石破天以梅雪逢夏對應! |
| 當白萬劍使出明駝西來時,石破天以千鈞壓駝對應! |
| 當白萬劍使出風沙莽莽時,石破天以大海沉沙對應! |
| 當白萬劍使出月色昏黃時,石破天以赤日炎炎對應! |
| 當白萬劍使出暗香疏影時,石破天以鮑魚之肆對應! |
| 當兔牙妹使出制服誘惑時,泰大以猛虎硬爬山對應! |
| 當兔牙妹使出黑絲誘惑時,泰大以驚天爆橘拳對應! |
+-------------------------------------------------------------------+
參考資料: Ode to Gallantry,1965, By Louis Cha.