[英]Moving data in an Excel spreadsheet, will I need to use VBA? If so, how would I go about doing it?
as cliche as it sounds, long time reader, first time poster. 听起来陈词滥调,长期的读者,第一次的海报。 I'm currently helping a family member out with some work and he has to sort through several thousand records and slightly change the format, obviously without some sort of automation it would take tens of hours and he asked me if I could help do it quickly.
我目前正在帮助一位家庭成员完成一些工作,他必须整理几千条记录并稍稍更改格式,显然如果没有某种自动化,这将需要数十个小时,他问我是否可以快速完成工作。 At first I thought I could, but I'm a little over my head with some of this stuff.
起初我以为可以,但是我对其中的一些东西有些不满意。
Basically, he has this data in this type of format: 基本上,他具有以下格式的数据:
Sample No 1 Ag 20 1 Au 50 1 Cu 80 2 AG 1 2 Au 30 3 Cu 30
But we need the data like this: 但是我们需要这样的数据:
Sample No. Ag Au Cu 1 20 50 80 2 1 30 - 3 - - 30
At first I thought I could do it with a formula to move the data horizontally. 起初,我以为可以用公式来水平移动数据。 The only problem is the missing data would preferably be filled with a '-', but in the original data given they are just left out entirely, so Im assuming I'll need VBA.
唯一的问题是丢失的数据最好用'-'填充,但在给定的原始数据中,它们被完全遗漏了,因此我假设我需要VBA。
Sorry if I left anything out, but any pointers in the right direction with VBA would be incredibly handy. 抱歉,如果我遗漏了任何内容,但是使用VBA指向正确方向的任何指针将非常方便。
Thanks 谢谢
EDIT: Fixed formatting and had two numbers switched, sorry guys. 编辑:固定格式,并切换了两个数字,对不起。
You can use Pivot Tables for this. 您可以为此使用数据透视表 。
Assuming your data is currently in a single column, you can do the following: 假设您的数据当前在单个列中,则可以执行以下操作:
You won't have dashes for your missing data, but this should do what you want. 丢失的数据不会破折号,但这应该可以实现您想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.