Excel help please- need to remove some data v carefully
Discussion
Hey Guys, hoping someone can help to teach me something!
have a list of data extracted from an accounting program at work- it lists supplier name, invoices received, value and total of the value. I need 2 pieces of data from the information- the company name and the total. I have well over 1500 suppliers to get the data for so doing it manually is going to take a very long time!
Data looks like:

The 2 bits of data i need are "anycompany" and the "£720" matched to it.
The number of lines of data between those 2 bits can vary from 2 to hundreds. The lines of data from the Total to the Next copmany heading also varies, but can include text, data etc.
Differentiators that i can think of are that the company names are always text in bold, and the totals are the only numbers in that column to be in bold.
Please please please please help
have a list of data extracted from an accounting program at work- it lists supplier name, invoices received, value and total of the value. I need 2 pieces of data from the information- the company name and the total. I have well over 1500 suppliers to get the data for so doing it manually is going to take a very long time!
Data looks like:

The 2 bits of data i need are "anycompany" and the "£720" matched to it.
The number of lines of data between those 2 bits can vary from 2 to hundreds. The lines of data from the Total to the Next copmany heading also varies, but can include text, data etc.
Differentiators that i can think of are that the company names are always text in bold, and the totals are the only numbers in that column to be in bold.
Please please please please help

Not easy without using VBA.
In simple terms, use VBA to:
Step through the first column.
When it finds a cell with .texteffect.bold = true write that out to a cellC
Continue stepping through rows but checking next colum for .texteffect.bold = true.
When you find it write that to next to your company name
Go back to checking the first column
In simple terms, use VBA to:
Step through the first column.
When it finds a cell with .texteffect.bold = true write that out to a cellC
Continue stepping through rows but checking next colum for .texteffect.bold = true.
When you find it write that to next to your company name
Go back to checking the first column
Could try this, assumes there is a blank line before the company name (need to add one to the first row)
Paste this into every cell in column C
Will put an "x" in Column C for each line of Company name and Total line
The use Excel to filter on column C where it matches "x" ; cut and paste the result to another sheet.
Not nice, but the format isn't exactly helpful.
Paste this into every cell in column C
=IF(ISBLANK(A2),IF(ISBLANK(B2)," ","x"),IF(ISBLANK(B2),IF(ISBLANK(A1),"x",""),""))
Will put an "x" in Column C for each line of Company name and Total line
The use Excel to filter on column C where it matches "x" ; cut and paste the result to another sheet.
Not nice, but the format isn't exactly helpful.
bonsai said:
Do you have access to the accounting program? If so I would go back to that and try to find a better way of exporting the data you need.
This is definitely the best solution, failing that it's VBA, but it is a VERY simple coding job. An Excel VBA specific forum will probably give you a solution.Hey Guys unfortunately the accounting program was developed in the dark ages by a caveman- i have never seen such an impossible system to run a query from- its not even as if i can run a crystal report; the underlying database is utterly unaddressable. Its a system we are working very very hard to get away from.
unfortunately at the moment my skills only stretch to simple Macros, Vlookups pivots etc. VBA is just a bit too far away!
unfortunately at the moment my skills only stretch to simple Macros, Vlookups pivots etc. VBA is just a bit too far away!
Ok, not too sure how to express it in VBA, but you can do it by recording a macro.
Go to the company name, hold down Control and press down. It should go to the last row before a blank one (which should be the row above the total). then press the down arrow once, and then the right arrow.
Assuming that does select the information reliably, you could then add another left arrow to get back to column 1, and then another control-down to get to the next name.
If that works properly, you can add in a copy of the cell, switch to a new workbook, and paste it back in again. A bit of a mess but should work.
Go to the company name, hold down Control and press down. It should go to the last row before a blank one (which should be the row above the total). then press the down arrow once, and then the right arrow.
Assuming that does select the information reliably, you could then add another left arrow to get back to column 1, and then another control-down to get to the next name.
If that works properly, you can add in a copy of the cell, switch to a new workbook, and paste it back in again. A bit of a mess but should work.
sub totals won't work as you have to sort the data first and i can't sort the data without moving it around first- the end aim is to actually sub-total the data up!
Simple macros won't work as the space between the name line and the amount line varies from 2 to 200 lines! don't think a simple macro can cope with this variability can it?
Simple macros won't work as the space between the name line and the amount line varies from 2 to 200 lines! don't think a simple macro can cope with this variability can it?
thanks to those guys that have offered to help with the data. Its very much appreciated but the information in the report is sensitive from a number of point of views so i can't send it out!
Would it be possible If i cleaned a bit of the file and sent it to you, for you to write a macro that i could run on the whole file? The other thing is that i need to do this operation every fortnight which is why learnging to do it myself might have been a good plan. If any of you guys can help within these unhelpful constraints then i would be very very grateful.
Will approach some excel forums as well.
Cheers
jim
Would it be possible If i cleaned a bit of the file and sent it to you, for you to write a macro that i could run on the whole file? The other thing is that i need to do this operation every fortnight which is why learnging to do it myself might have been a good plan. If any of you guys can help within these unhelpful constraints then i would be very very grateful.
Will approach some excel forums as well.
Cheers
jim
I'm assuming the last cell in column A adjascent to the £720 (A6) is blank and A7 would contain "Any Company 2" etc?
If so, to do it without code see here for an example spreadsheet I've just knocked up: http://www.locostfireblade.co.uk/Downloads/Sorting...
If you copy and paste the top two rows of C, D and E (ignoring my title row of course) into the same columns on your spreadsheet then copy the cells down the entire length of your spreadsheet, the rest should be fairly self explainatory. It's messier than VBA but will do the job and possibly easier to understand / adapt as you do it every few weeks with different data.
Edit: Hmm, just re-read your original post, I think this "The lines of data from the Total to the Next copmany heading also varies, but can include text, data etc." makes my idea fail because you have no way of identifying "Any Company 2" using the blank cell above it if cells above and below it have text etc in there, and I think that's going to be pretty hard to get around even with VBA, because it still needs to look for some kind of pattern in the data.
If so, to do it without code see here for an example spreadsheet I've just knocked up: http://www.locostfireblade.co.uk/Downloads/Sorting...
If you copy and paste the top two rows of C, D and E (ignoring my title row of course) into the same columns on your spreadsheet then copy the cells down the entire length of your spreadsheet, the rest should be fairly self explainatory. It's messier than VBA but will do the job and possibly easier to understand / adapt as you do it every few weeks with different data.
Edit: Hmm, just re-read your original post, I think this "The lines of data from the Total to the Next copmany heading also varies, but can include text, data etc." makes my idea fail because you have no way of identifying "Any Company 2" using the blank cell above it if cells above and below it have text etc in there, and I think that's going to be pretty hard to get around even with VBA, because it still needs to look for some kind of pattern in the data.
Edited by LocoBlade on Friday 7th May 23:57
Try this one, should get round the issue above...
http://www.locostfireblade.co.uk/Downloads/Sorting...
As I said, its messy, but perhaps just using the normal formulas rather than VBA, might be easier to use if you dont understand VB
http://www.locostfireblade.co.uk/Downloads/Sorting...
As I said, its messy, but perhaps just using the normal formulas rather than VBA, might be easier to use if you dont understand VB
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff




