I am using a Vlookup to take the content of a cell in another sheet. The problem is that this cell has 2 lines, written by VBA, seperated by chr(10) or vbLF (equivalent of alt+enter to switch lines in a cell). I only want the first line. This is what I have right now (RechercheV is Vlookup in French):
=RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX)
It returns "Transfert1Responsable:IC" (in the target cell, Transfert1 is on the first line, and Responsable:IC is on the next). I want to break at the line change and only retain "Transfert1".
Thanks a lot!
答案 0 :(得分:0)
输出换行符的英文名称为CHAR(10),法语为CAR(10)。所以使用这个:http://www.gcflearnfree.org/excel-tips/how-to-use-excels-vlookup-function
我改变了我的公式:
= GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX))-1)
它完美无缺!
Char(10)的来源:http://blog.contextures.com/archives/2011/08/08/add-line-break-in-excel-formula/
编辑:这样做的整个目标是添加一个IF语句,该语句将根据用户选择的语言更改文本。该语言选自另一个表格(英语法语)中的验证列表,VlookUp查看第3列为法语版本,第4列为英语版本。在添加了IF语句之后,我最终得到了这个怪物(除了问题,我发布了以防任何人想要进一步使用他们的VlookUp功能):
=SI(Paramètres!cell_langue="FR"; GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;3;FAUX))-1); GAUCHE(RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;4;FAUX); TROUVE(CAR(10); RECHERCHEV("btn_" & etape_doc;LangueEtapes!A:D;4;FAUX))-1))