Sub If_Loop() '' e18
Dim cell As Range
For Each cell In Range("A2:A6")
If cell.value > 0 Then
cell.Offset(0, 1).value = "Positive"
ElseIf cell.value < 0 Then
cell.Offset(0, 1).value = "Negative"
Else
cell.Offset(0, 1).value = "Zero"
End If
Next cell
End Sub
(function()
{
var oSheet = Api.GetSheet("Sheet1");
var oRange = oSheet.GetRange("A2:A6");
oRange.ForEach(function(cell) {
var newCell = oSheet.GetCells(cell.GetRow(), cell.GetCol()+1);
var value = cell.GetValue();
if (value > 0) {
newCell.SetValue("Positive")
} else if (value < 0) {
newCell.SetValue("Negative")
} else if (value == 0) {
newCell.SetValue("Zero")
};
});
})();