private void button2_Click(object sender, EventArgs e)
{
xlapp = new Excel.Application();
xlwb = xlapp.Workbooks.Open("C:\\Users\\Vijay\\Documents\\File1.xlsm");
xlws = xlwb.Worksheets["Sheet1"];
foreach (Excel.OLEObject OE1 in xlws.OLEObjects())
{
MessageBox.Show(Convert.ToString(OE1.Name));
}
xlwb.Close();
xlapp.Quit();
}
大家好, 请帮忙,我有一个计算列,它从包含1,2,3,4等数字的列中读取数据。我希望计算列检查当前数字,然后分配一个字符串。
任何人都可以帮助这个嵌套吗?谢谢
答案 0 :(得分:0)
您只需将条件嵌套在每个onEachFeature:
块的“false”部分中。
举一个简单的例子,假设你只有两个月。从概念上讲,您的公式可能如下所示:
IF()
其转换为以下单行公式:
IF([Month (Calculated)]="11", // if the column equals 11...
"November", // then display "November"
IF([Month (Calculated)]="12", // otherwise... if the column equals 12
"December", // then display "December"
"No date" // otherwise... display "No date"
)
)
现在只需将这种方法扩展到所有十二个月,你就会得到这样的公式:
IF([Month (Calculated)]="11","November",IF([Month (Calculated)]="12", "December","No date"))
不幸的是,该公式超出了计算列公式的255个字符限制。要绕过该限制,您可以使用其他计算列将公式分解为更小的部分。
如何解决这个问题的一个例子如下:
计算第1栏:
IF([Month (Calculated)]="1", "January", IF([Month (Calculated)]="2", "February", IF([Month (Calculated)]="3", "March", IF([Month (Calculated)]="4", "April", IF([Month (Calculated)]="5", "May", IF([Month (Calculated)]="6", "June", IF([Month (Calculated)]="7", "July", IF([Month (Calculated)]="8", "August", IF([Month (Calculated)]="9", "September", IF([Month (Calculated)]="10", "October", IF([Month (Calculated)]="11", "November", IF([Month (Calculated)]="12", "December", "No date"))))))))))))
(注意最后对IF([Month (Calculated)]="7","July",IF([Month (Calculated)]="8","August",IF([Month (Calculated)]="9","September",IF([Month (Calculated)]="10","October",IF([Month (Calculated)]="11","November",IF([Month (Calculated)]="12", "December",[Calculated Column 2]))))))
的引用。)
计算第2栏:
[Calculated Column 2]
答案 1 :(得分:0)
跟随Thriggle,
对于破坏方法,请使用显示结果的第3列
计算第3栏
If([Calculated Column 1]="No date",[Calculated Column 2],[Calculated Column 1])