複数の条件に基づくカラーセル私は条件に基づいてセルを着色するために次のコードを書きました。私はもう一つ条件を追加する必要があります -
重量が目標の-2%以内であれば、セルを黄色に着色する必要があります。
dt << New Column("color cells",
Formula(If(:Target> :weight, :weight << color cells("Red", Row()); .,
:weight << color cells("Green", Row()); .)),
Hide(1)
);
ありがとう
再:複数の条件に基づくカラーセル1。もしあなたがJSLで作業するつもりなら、あなたはスクリプトガイドを読むために時間をかける必要があります:ヘルプ==>本==>スクリプトガイド
2。以下は、あなたが説明したようにカラーリングを生成する簡単なスクリプトです。
Names Default To Here( 1 );
dt = Current Data Table();
colNamesList = dt << get column names( string );
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
For( theCol = 2, theCol <= N Items( colNamesList ), theCol++,
If(
:Target[theRow] > Column( dt, colNamesList[theCol] )[theRow],
Column( dt, colNamesList[theCol] ) << color cells( "Red", theRow );
.;,
Column( dt, colNamesList[theCol] )[theRow] < :Target[theRow] + (.02 *
Abs( :Target[theRow] )) & Column( dt, colNamesList[theCol] )[theRow] >
:Target[theRow] - (.02 * Abs( :Target[theRow] )),
Column( dt, colNamesList[theCol] ) << color cells( "Yellow", theRow );
.;,
Column( dt, colNamesList[theCol] ) << color cells( "Green", theRow );
.;
)
)
);再:複数の条件に基づくカラーセルこのロジックの変形をスクリプト化する必要があります。4列のデータがあり、各セルの値を目標値と比較する必要があります。また、私は手持ちのカラム名を知りませんでした。これを行う方法?簡単に言うと、A、B、C、D列の値をTarget列の対応する値とカラーコード(緑、黄、赤)で比較する必要があります。
| ターゲット | A | B | C | D |
| 99% | 1% | 8% | 93% | 10% |
| 52% | 55% | 62% | 22% | 19% |
| 39% | 89% | 18% | 33% | 25.50% |
| 16% | 11% | 92% | 10% | 2% |
再:複数の条件に基づくカラーセルもし(
:ターゲット>:重量
:重量<<カラーセル( "Red"、Row());
、
:weight <:Target +(.02 * Abs(:Target))&:weight>:ターゲット - (.02 *
Abs(:Target))、
:重量<<カラーセル( "黄色"、Row());
、
:重量<<カラーセル( "Green"、Row());
;
;