حساب دالة 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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create new workbook | |
Workbook workbook = new Workbook(); | |
// Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Add data for VLOOKUP | |
worksheet.Cells["A1"].PutValue("Apple"); | |
worksheet.Cells["A2"].PutValue("Orange"); | |
worksheet.Cells["A3"].PutValue("Banana"); | |
// Access cell A5 and A6 | |
Cell cellA5 = worksheet.Cells["A5"]; | |
Cell cellA6 = worksheet.Cells["A6"]; | |
// Assign IFNA formula to A5 and A6 | |
cellA5.Formula = "=IFNA(VLOOKUP(\"Pear\",$A$1:$A$3,1,0),\"Not found\")"; | |
cellA6.Formula = "=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 | |
Console.WriteLine(cellA5.StringValue); | |
Console.WriteLine(cellA6.StringValue); |
إخراج وحدة التحكم
هنا هو إخراج وحدة التحكم من نموذج التعليمات البرمجية أعلاه.
Not found
Orange