嗨 - 我是 jsl 腳本的新手,我正在嘗試構建一個 jsl 語句,如下所示:
如果 A 列為空,則 C 列 = 空,
否則如果 A 列 < 500 且 B 列 = 200,C 列 = 0,
否則,如果 A>500 列,C 列 = 1。
我將如何構建一個 jsl 公式來做到這一點?謝謝!
這是我在徹底搜索 jsl 索引、幫助菜單和 google 以及大量反複試驗後得出的結論......但它沒有奏效。我的 C 列公式是:
公式 (
If (ismissing (:column A), empty(),
:column A< 500 & :column B == 200, 1,
:columnA>500, 0
))
@Campbell_Ted_R
嘗試這個:
names default to here (1);
dt = Current data table();
dt << new column ("C","Numeric", "ordinal", Formula (If(
Is Missing( :A ),.,
:A < 500 & :B == 200, 0,
:A > 500, 1
)));
謝謝羅恩。由於某種原因,“空”條件未註冊。也就是說,如果 :A 為空,則 :C 為 1。
??
它現在識別空單元格並將它們正確填充為空 (yay),正確解釋第二個條件並適當地設置 0,但它不會使其成為第三個 (else if) 條件。也就是說,它永遠不會是 1,即使有很多時候它應該是。
這個對嗎?
New Table( "Untitled",
Add Rows( 12 ),
New Column( "A",
Numeric,
"Continuous",
Format( "Fixed Dec", 12, 0 ),
Set Values( [., ., 400, 400, 550, 550, ., ., 400, 400, 550, 550] )
),
New Column( "B",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values( [200, 61, 200, 66, 200, 60, 200, 51, 200, 61, 200, 65] )
),
New Column( "C",
Numeric,
"Ordinal",
Format( "Best", 10 ),
Formula( If( Is Missing( :A ), ., :A < 500 & :B == 200, 0, :A > 500, 1 ) ),
Set Selected
)
);