Question

I have 100 Excel sheets of financial statement to extract selected data. For instance, the first sheet is from company A, its 'Total assets' item is in A10, but in the second sheet the 'Total assets' is in A17, the third in A12....

So every financial statement's items have different positions in their Excel sheet. Is there any way I can extract them by specify their name, such as 'Total assets', 'Other earning assets' etc, then I don't need to read their location one by one.

Was it helpful?

Solution

sorry about the delay. You'll want to import the data using

[num,txt] = xlsread('EXCELFILEHERE');

num will be a matrix of the numerical values while txt is a cell array of all the text values. Next you'll need to search txt for your desired phrase using something like

[row,col] = find(ismember(txt,'Total Assets')==1)

This will give you a list of columns and the corresponding rows where you'll find that phrase in txt. Then it's just a matter of plugging that row back into num to get the data you need. Keep in mind that the sizes of num and txt might be a bit off depending on how your data is formatted. I suggest .xls files if you can.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top