在 excel 2002 中将文本字符串附加到列的所有单元格的左侧?
我有两列,有两个值。我想在 A 列所有单元格的左侧附加一些文本,并连接到 B 列所有单元格的右侧。
基本上,我试图避免键入一大堆sql更新。例如,如果我有一个
ID 为员工姓名的 Excel
135 拉斯普京
76 Bush
我想生成这样的东西
UPDATE EMPLOYEES SET ID = '135', WHERE employee_name= 'RASPUTIN'
UPDATE EMPLOYEES SET ID = '76', WHERE employee_name= 'BUSH'
那么也许有一个解决方案,将文本附加到单元格,然后合并行?
我更喜欢内置函数,因为我不熟悉 VBA,谢谢!
PS 在超级用户上交叉发布,但尚未回复。
I have two columns with two values.. I want to append some text to the left of all the cells of Column A and concatenate to the right of all the cells of Column B.
Basically I'm trying to avoid having to type in a whole bunch of sql updates. so for example if i have an excel with
ID Employee Name
135 Rasputin
76 Bush
I want to generate something like this
UPDATE EMPLOYEES SET ID = '135', WHERE employee_name= 'RASPUTIN'
UPDATE EMPLOYEES SET ID = '76', WHERE employee_name= 'BUSH'
So perhaps a solution of appending text to the cells and then merging the rows?
I prefer a built in function as I'm not familiar with VBA thanks!
PS crossposted on superuser but no response yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您不能在 C1 列中创建一个公式,其内容如下:
然后将该公式复制下来。然后您应该能够将其剪切并粘贴到您的 SQL 查询应用程序中。
Can't you create a formula in column C1 which says something like:
And then copy that formula down. You should then be able to cut and paste that into your SQL query application.
Excel中有一个CONCATENATE函数...我已经多次使用这个函数来根据Excel电子表格数据生成SQL查询
如果您的Id列是A并且您的名字在B中,则此代码可以工作
There is a CONCATENATE function in Excel.... I've used this function many times to generate SQL queries based on Excel spreadsheet data
This code works provided your Id column is A and your name is in B
如果我理解正确的话:
应该是你想要的(假设 id 位于 A 列,名称位于 B 列)。
If I understand correctly:
should be what you want (assuming the id is in column A and the name in column B).
在超级用户中正确回答 https://superuser.com/questions/55262/append-a-text-string-to-the-left-of-all-the-cells-of-a-column-in-excel- 2002
感谢您的回答!这就成功了:
="UPDATE EMPLOYEES SET ID = '" & A1& “' WHERE EMPLOYEE = '” & B1& “'”
Answered correctly in superuser https://superuser.com/questions/55262/append-a-text-string-to-the-left-of-all-the-cells-of-a-column-in-excel-2002
Thanks for the answers! This did the trick:
="UPDATE EMPLOYEES SET ID = '" & A1 & "' WHERE EMPLOYEE = '" & B1 & "'"