Hi all
A colleague of mine has a large worksheet with data on it that has been
imported from another application into columns A and B in Excel. Column A,
for argument's sake, contains a cost centre number and Column B contains text
relating to that cost centre number. The text in column B isn't imported into
one cell, it is spread over several rows - one line of text per row. Because
of this, the information in Column A is duplicated for the same number of
rows. For example:-
A B
1 cc 1001 This cost centre number
2 cc 1001 is for Region 2 and
3 cc 1001 was introduced September 05
4 cc 1001 to be used until further notice.
This is what they need to do............. Remove the duplicate information
in Column A (rows 2-4) and merge the information n B1:B4 into one cell.
I realise we can go through and do this manually by simply deleting the
cells etc but can anybody advise me of an easier way to do this? Otherwise,
it will take hours.
Any help would be greatly appreciated.
Thank you.
Louise
Hi Louise
The following is a fairly inelegant solution, but it is quite quick to
do and achieves the desired result.
! am assuming here that the maximum lines per cc is 4, if it greater it
will be just a case of inserting an extra column into the following
instructions for each extra row that the data per cc contains.
With data in columns A and B with headers assumed to be in Row 1
in D2 =IF(A2=A1,quot;quot;,A2) in E2 =IF(A2=A1,quot;quot;,B2) in F2 =IF(A3=A2,B3,quot;quot;)
in G2 =IF(A4=A3,B4,quot;quot;) in H2 =IF(A5=A4,B5,quot;quot;)
If there are more than 4 lines per CC, then insert more columns at this
point, and move the following section along by the number of columns
inserted.
in J2 =D2
in K2 =E2amp;quot; quot;amp;F2amp;quot; quot;amp;G2amp;quot; quot;amp;H2
Again, if you use more columns, then keep adding amp;quot; quot;amp; column
Copy all the formulae in D2:K2 down to cover the range of rows in A
having data.
(It will look very messy, but don't worry!!)
Copy the complete block of data from J2:Knn where nn is the last row of
data.
Place cursor in J2, Paste Specialgt;Values
Mark block of data in columns J and K gt;Datagt;Sortgt; Column J gt;Ascending
All the quot;drossquot; will drop to the bottom.
Copy the range of quot;goodquot; data to another location.
Other may post more sophisticated formulae using offsets which will
avoid the untidy looking mess, and avoid the sort but I don't have time
to work that out right now, and this should work OK for you.
--
Regards
Roger Govierquot;Louisequot; gt; wrote in message
...
gt; Hi all
gt;
gt; A colleague of mine has a large worksheet with data on it that has
gt; been
gt; imported from another application into columns A and B in Excel.
gt; Column A,
gt; for argument's sake, contains a cost centre number and Column B
gt; contains text
gt; relating to that cost centre number. The text in column B isn't
gt; imported into
gt; one cell, it is spread over several rows - one line of text per row.
gt; Because
gt; of this, the information in Column A is duplicated for the same number
gt; of
gt; rows. For example:-
gt;
gt; A B
gt;
gt; 1 cc 1001 This cost centre number
gt; 2 cc 1001 is for Region 2 and
gt; 3 cc 1001 was introduced September 05
gt; 4 cc 1001 to be used until further notice.
gt;
gt; This is what they need to do............. Remove the duplicate
gt; information
gt; in Column A (rows 2-4) and merge the information n B1:B4 into one
gt; cell.
gt;
gt; I realise we can go through and do this manually by simply deleting
gt; the
gt; cells etc but can anybody advise me of an easier way to do this?
gt; Otherwise,
gt; it will take hours.
gt;
gt; Any help would be greatly appreciated.
gt;
gt; Thank you.
gt;
gt; Louise
- May 27 Tue 2008 20:44
Finding/deleting duplicates and merging cells
close
全站熱搜
留言列表
發表留言
留言列表

