``` //create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("E4:J5").setValue(new Object[][]{ {1, 2, 3}, {4, 5, 6} }); worksheet.getRange("I6:J8").setValue(new Object[][]{ {2, 2}, {3, 3}, {4, 4} }); //O PQ //2 4#N/A //1215 #N/A //#N/A#N/A #N/A worksheet.getRange("O9:Q11").setFormulaArray("=E4:G5*I6:J8"); //judge if Range O9 has array formula. if (worksheet.getRange("O9").getHasArray()) { //set O9's entire array's interior color. IRange currentarray = worksheet.getRange("O9").getCurrentArray(); currentarray.getInterior().setColor(Color.GetGreen()); } //save to an excel file workbook.save("UseArrayFormula.xlsx"); ``` ``` //create a new workbook var workbook = Workbook() val worksheet = workbook.worksheets.get(0) worksheet.getRange("E4:J5").value = arrayOf(arrayOf(1, 2, 3), arrayOf(4, 5, 6)) worksheet.getRange("I6:J8").value = arrayOf( arrayOf(2, 2), arrayOf(3, 3), arrayOf(4, 4)) //O PQ //2 4#N/A //1215 #N/A //#N/A#N/A #N/A worksheet.getRange("O9:Q11").formulaArray = "=E4:G5*I6:J8" //judge if Range O9 has array formula. if (worksheet.getRange("O9").hasArray) { //set O9's entire array's interior color. val currentarray = worksheet.getRange("O9").currentArray currentarray.interior.color = Color.GetGreen() } //save to an excel file workbook.save("UseArrayFormula.xlsx") ```