如何在Excel中分析数据

huangapple go评论68阅读模式
英文:

How to analyze data in Excel

问题

我有一个包含大量需要分析的数据的Excel文档。
数据基本上是带有相应错误消息的对象。典型的输出如下所示:

**REC NO07/121007163**
Valuation for 0001 IFRS16 Balance sheet valuation
Asset transactions already posted need to be reversed
The valuation could not be completed
**REC NO07/121007165**
Valuation for 0001 IFRS16 Balance sheet valuation
Asset transactions already posted need to be reversed
The valuation could not be completed
**REC NO07/121007220**
Valuation for 0001 IFRS16 Balance sheet valuation
Closing balance 5 070,00 NOK liability available
Difference 5 070,00- NOK between clearing and expense available
**REC NO07/121007221**
Valuation for 0001 IFRS16 Balance sheet valuation
Closing balance 5 070,00 NOK liability available
Difference 5 070,00- NOK between clearing and expense available

上面粗体的部分是对象。这在Excel中不是粗体的,但我在这里加粗以解释。粗体部分之间的所有内容都是该对象的错误消息。

错误消息的长度(行数)在不同对象之间可能不同。

我想做的是将上述内容转换为以下格式:

REC NO07/121007163    Valuation for 0001 IFRS16 Balance sheet valuation. Asset transactions already posted need to be reversed. The valuation could not be completed
REC NO07/121007165    Valuation for 0001 IFRS16 Balance sheet valuation. Asset transactions already posted need to be reversed. The valuation could not be completed
REC NO07/121007220    Valuation for 0001 IFRS16 Balance sheet valuation. Closing balance 5 070,00 NOK liability available. Difference 5 070,00- NOK between clearing and expense available
REC NO07/121007221    Valuation for 0001 IFRS16 Balance sheet valuation. Closing balance 5 070,00 NOK liability available. Difference 5 070,00- NOK between clearing and expense available

我在对象和错误消息之间添加了一个制表符。

我使用“. ”将错误消息的所有行组合在一起。

这在Excel中是否可能,如果可能的话,是否有人可以帮助我做到这一点?

谢谢

最好的问候
Antonis

我尝试在Excel中使用公式来实现这一点,但由于每个错误消息的行数不同,我无法解决它。

英文:

I have an Excel document that consists of huge data in need of analysis.
The data is basically objects with corresponding error messages. Typical output is:

**REC NO07/121007163**
Valuation for 0001 IFRS16 Balance sheet valuation
Asset transactions already posted need to be reversed
The valuation could not be completed
**REC NO07/121007165**
Valuation for 0001 IFRS16 Balance sheet valuation
Asset transactions already posted need to be reversed
The valuation could not be completed
**REC NO07/121007220**
Valuation for 0001 IFRS16 Balance sheet valuation
Closing balance 5 070,00 NOK liability available
Difference 5 070,00- NOK between clearing and expense available
**REC NO07/121007221**
Valuation for 0001 IFRS16 Balance sheet valuation
Closing balance 5 070,00 NOK liability available
Difference 5 070,00- NOK between clearing and expense available

What you see in bold above, is the object. This is not in bold in Excel, but I have made it bold here to explain. Everything in-between is the error message for that object.

The length (number of lines) of the error message could vary between objects.

What I would like to do, is basically convert the above to this:

REC NO07/121007163	Valuation for 0001 IFRS16 Balance sheet valuation. Asset transactions already posted need to be reversed. The valuation could not be completed
REC NO07/121007165	Valuation for 0001 IFRS16 Balance sheet valuation. Asset transactions already posted need to be reversed. The valuation could not be completed
REC NO07/121007220	Valuation for 0001 IFRS16 Balance sheet valuation. Closing balance 5 070,00 NOK liability available. Difference 5 070,00- NOK between clearing and expense available
REC NO07/121007221	Valuation for 0001 IFRS16 Balance sheet valuation. Closing balance 5 070,00 NOK liability available. Difference 5 070,00- NOK between clearing and expense available

I am adding a tab between the object and the error message.

I am combining all lines of the error message with ". "

Is this possible in Excel and if yes, is there anyone that could help me with that?

Thank you

Best regards
Antonis

I have tried to do this with formulas in Excel but as the number of lines for each error message varies, I was not able to solve it.

答案1

得分: 1

假设所有的错误代码都以 REC 开头,并且没有在问题中列出的标签中的 Excel 版本约束,那么你可以在单元格 B1 中使用以下公式:

=LET(A, A1:A16, m, ROWS(A), seq, SEQUENCE(m), idx, FILTER(seq, (LEFT(A,3)="REC")),
 start, idx+1, end, VSTACK(DROP(idx-1,1), m), MAP(start, end, 
  LAMBDA(s,e, INDEX(A,s-1)&" "&TEXTJOIN(". ",, FILTER(A, (seq>=s) * (seq<=e))))))

这是输出结果:
如何在Excel中分析数据

基本上,它首先找到错误代码的索引位置(idx),然后基于此找到每个错误消息的 startend 行。然后我们使用 MAP 来通过 TEXTJOIN 连接结果,在每次迭代中通过 FILTER 选择范围,并在错误代码前加上前缀(INDEX(A,s-1))。

英文:

Assuming all the error codes start with REC and no excel version constraints per tags listed in the question, then you can use the following formula in cell B1:

=LET(A, A1:A16, m, ROWS(A), seq, SEQUENCE(m), idx, FILTER(seq, (LEFT(A,3)=&quot;REC&quot;)),
 start, idx+1, end, VSTACK(DROP(idx-1,1), m), MAP(start, end, 
  LAMBDA(s,e, INDEX(A,s-1)&amp;&quot; &quot;&amp;TEXTJOIN(&quot;. &quot;,, FILTER(A, (seq&gt;=s) * (seq&lt;=e))))))

Here is the output:
如何在Excel中分析数据

Basically, it finds first the index position of the error codes (idx) and based on that finds the start and end rows of each error message. Then we use MAP to concatenate the result via TEXTJOIN selecting on each iteration the range via FILTER and prefixing the error code (INDEX(A,s-1)).

huangapple
  • 本文由 发表于 2023年2月7日 01:08:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364436.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定