حساب وظيفة IFNA باستخدام Aspose.Cells
Contents
[
Hide
]
تدعم Aspose.Cells حساب وظيفة IFNA في Excel. تقوم وظيفة IFNA بإرجاع القيمة التي تحددها إذا عادت الصيغة بقيمة خطأ #N/A. وإلا، ستقوم بإرجاع نتيجة الصيغة.
حساب وظيفة IFNA باستخدام Aspose.Cells
الكود النموذجي التالي يوضح حساب وظيفة IFNA باستخدام Aspose.Cells.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(CalculateIFNAfunction.class); | |
// Create new workbook | |
Workbook workbook = new Workbook(); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Add data for VLOOKUP | |
worksheet.getCells().get("A1").putValue("Apple"); | |
worksheet.getCells().get("A2").putValue("Orange"); | |
worksheet.getCells().get("A3").putValue("Banana"); | |
// Access cell A5 and A6 | |
Cell cellA5 = worksheet.getCells().get("A5"); | |
Cell cellA6 = worksheet.getCells().get("A6"); | |
// Assign IFNA formula to A5 and A6 | |
cellA5.setFormula("=IFNA(VLOOKUP(\"Pear\",$A$1:$A$3,1,0),\"Not found\")"); | |
cellA6.setFormula("=IFNA(VLOOKUP(\"Orange\",$A$1:$A$3,1,0),\"Not found\")"); | |
// Caclulate the formula of workbook | |
workbook.calculateFormula(); | |
// Print the values of A5 and A6 | |
System.out.println(cellA5.getStringValue()); | |
System.out.println(cellA6.getStringValue()); |
مخرجات الوحدة
فيما يلي مخرجات وحدة الإدخال الخاصة بالكود المصدري أعلاه.
Not found
Orange