// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("B:C").setColumnWidth(17); Object data = new Object[][]{ {"Name", "City", "Birthday", "Eye color", "Weight", "Height"}, {"Richard", "New York", new GregorianCalendar(1968, 5, 8), "Blue", 67, 165}, {"Nia", "New York", new GregorianCalendar(1972, 6, 3), "Brown", 62, 134}, {"Jared", "New York", new GregorianCalendar(1964, 2, 2), "Hazel", 72, 180}, {"Natalie", "Washington", new GregorianCalendar(1972, 7, 8), "Blue", 66, 163}, {"Damon", "Washington", new GregorianCalendar(1986, 1, 2), "Hazel", 76, 176}, {"Angela", "Washington", new GregorianCalendar(1993, 1, 15), "Brown", 68, 145} }; worksheet.getRange("A1:F7").setValue(data); //weight above 1 std dev average, set its interior color to green. IAboveAverage averageCondition = worksheet.getRange("E2:E7").getFormatConditions().addAboveAverage(); averageCondition.setAboveBelow(AboveBelow.BelowAverage); averageCondition.setNumStdDev(1); averageCondition.getInterior().setColor(Color.GetPink()); // Save to an excel file workbook.save("CreateAverageRule.xlsx");