显示cel的值而不是单元格地址
如果在单元格中有以下数据,我想提取一些文本:
salutation login ID email password first_name middle_name last_name gender date_of_birth account_status user_address1 user_address2 city postal_code country telephone id_card_number role Mr. bawan 1 bawan@gmail.com bbbbbb Bashir Awan male 18-07-1988 active 55-B Faisal Town Lahore 54000 Pakistan 0423-5599229 34220-0353392-1 admin Mr. njawad 2 nasir@hotmail.com nnnnnn Nasir Jawad male 21-03-1979 active 193 SherShah Colony Gujranwala 54000 Pakistan 0319-2292299 35210-3523327-2 supervisor Dr. hakhan 3 faisal_khan@yahoo.com hhhhhh faisal Aslam Khan male 12-05-1973 active House# 77 Mumtaz Street, Sham Nagar Gujrat 54000 Pakistan 0349-8280022 34220-0353392-1 admin Ms. tnoor 4 tayyaba.noor@live.com tttttt Tayyaba Noor female 15-01-1980 active 483 Ghazanvi Road Faisalabad 54000 Pakistan 0381-5589333 34220-0353392-1 marketing executive
这个数据如上所示,在excel中正确格式化显示有点整齐。
这就是我所做的:
=CONCATENATE("{:salutation=>", A2 , ", :login =>",B2," , :ID=>", C2,", :email =>",D2,", :password=>",E2,", :first_name=>",F2,", :middle_name=>",G2,", :last_name=>",H2,", :gender =>",I2," , data_of_birth=>",J2,", :account_status=>",K2,", :user_address1=>",L2,", :user_address2=>",M2,", :city=>",N2,", :postal_code=>",O2,", :country=>",P2,", :telephone=>",Q2,", :id_card_number=>",R2,", :role=>",S2,"},")
我得到了这个结果:
{:salutation=>Mr., :login =>bawan , :ID=>1, :email =>bawan@gmail.com, :password=>bawan1, :first_name=>Bashir, :middle_name=> , :last_name=>Awan, :gender =>male , data_of_birth=>18-07-1988, :account_status=>active, :user_address1=>55-B, :user_address2=>Faisal Town, :city=>Lahore, :postal_code=>54000, :country=>Pakistan, :telephone=>0423-5599229, :id_card_number=>34220-0353392-1, :role=>admin},
但是我想要生成这个:
{:salutation=>"Mr.", :login =>"bawan" , :ID=>"1", :email =>"bawan@gmail.com", :password=>"bawan1", :first_name=>"Bashir", :middle_name=>"" , :last_name=>"Awan", :gender =>"male" , data_of_birth=>"18-07-1988", :account_status=>"active", :user_address1=>"55-B", :user_address2=>"Faisal Town", :city=>"Lahore", :postal_code=>"54000", :country=>"Pakistan", :telephone=>"0423-5599229", :id_card_number=>"34220-0353392-1", :role=>"admin"},
那么在我的情况下要改变什么
=CONCATENATE(code)
生成以上!
引用在excel公式中有特殊的含义。 尝试使用CHAR(34)
来代替。 这不是“漂亮”,但这是我发现的解决方法:
=CONCATENATE("{:salutation=>",CHAR(34),A2,CHAR(34),", :login =>",CHAR(34),B2,CHAR(34)," , :ID=>",CHAR(34),C2,CHAR(34),", :email =>",CHAR(34),D2,CHAR(34),", :password=>",CHAR(34),E2,CHAR(34),", :first_name=>",CHAR(34),F2,CHAR(34),", :middle_name=>",CHAR(34),G2,CHAR(34),", :last_name=>",CHAR(34),H2,CHAR(34),", :gender =>",CHAR(34),I2,CHAR(34)," , data_of_birth=>",CHAR(34),J2,CHAR(34),", :account_status=>",CHAR(34),K2,CHAR(34),", :user_address1=>",CHAR(34),L2,CHAR(34),", :user_address2=>",CHAR(34),M2,CHAR(34),", :city=>",CHAR(34),N2,CHAR(34),", :postal_code=>",CHAR(34),O2,CHAR(34),", :country=>",CHAR(34),P2,CHAR(34),", :telephone=>",CHAR(34),Q2,CHAR(34),", :id_card_number=>",CHAR(34),R2,CHAR(34),", :role=>",CHAR(34),S2,,CHAR(34),"},")
编辑:您可以用""
(这不包括引号来表示文本)转义引号:
=CONCATENATE("{:salutation=>""",A2,""", :login =>""",B2,""" , :ID=>""",C2,""", :email =>""",D2,""", :password=>""",E2,""", :first_name=>""",F2,""", :middle_name=>""",G2,""", :last_name=>""",H2,""", :gender =>""",I2,""" , data_of_birth=>""",J2,""", :account_status=>""",K2,""", :user_address1=>""",L2,""", :user_address2=>""",M2,""", :city=>""",N2,""", :postal_code=>""",O2,""", :country=>""",P2,""", :telephone=>""",Q2,""", :id_card_number=>""",R2,""", :role=>""",S2,"""},")
感谢JustinJDavies指出这一点:)