여러 조건을 기반으로하는 색 세포조건에 따라 셀을 채색하기 위해 다음 코드를 작성했습니다. 하나 더 조건을 추가해야합니다.
무게가 목표의 -2 % 이내이면 셀을 황색으로 채색해야합니다. 어떻게해야합니까?
dt << New Column("color cells",
Formula(If(:Target> :weight, :weight << color cells("Red", Row()); .,
:weight << color cells("Green", Row()); .)),
Hide(1)
);
감사
다시 : 여러 조건을 기반으로 셀 색상1. JSL에서 작업 할 계획이라면 스크립팅 가이드 : Help ==> Books ==> Scripting Guide를 읽어보십시오.
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 열의 값을 대상 열의 해당 값과 색상 코드 (녹색, 노란색 또는 빨간색)와 비교할 필요가 있습니다.
| 목표 | 에이 | 비 | 기음 | 디 |
| 99 % | 1% | 8 % | 93 % | 10 % |
| 52 % | 55 % | 62 % | 22 % | 19 % |
| 39 % | 89 % | 18 % | 33 % | 25.50 % |
| 16 % | 11 % | 92 % | 10 % | 2 % |
다시 : 여러 조건을 기반으로 셀 색상만약(
: Target> : 무게,
: 무게 << 색상 셀 ( "Red", Row ());
.,,
: weight <: Target + (.02 * Abs (: Target)) & : weight> : Target - (.02 *
Abs (: 표적)),
: 무게 << 색상 셀 ( "노란색", 행 ());
.,,
: 무게 << 색상 셀 ( "녹색", 행 ());
.;
);