+ Reply to Thread
Results 1 to 16 of 16

Dissolve One Field, Append to another

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Dissolve One Field, Append to another

    Hello,

    I am trying something new and I didn't know what to search for in the forums. I have created a key map, where every page in the book is a different part of the city. The pages run sequentially (ie A1, A2, A3, B1, B2, B3). At the end there is an index with every street name listed. Next to each street name are the page numbers the street falls on. I have an Excel document, attached here, showing all the street names in one column and page number in another column. However, a street may be listed multiple times if it falls on multiple pages. I need to be able to "dissolve" the street names so they are listed once and append the page column to the street column. Therefore it will go from:

    Street Name
    Aaron St -------- D3
    Aaron St -------- D4
    Aaron St -------- D5
    Abby Ln -------- C2
    Abby Ln -------- D2

    To This:

    Street Name PageName
    Aaron St: D3; D4; D5
    Abby Ln: C2; D2

    I hope that makes sense. Thank you.
    Attached Files Attached Files
    Last edited by floyd434; 09-15-2010 at 09:34 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    In D3, dragged across as far as you need to and then down

    =IF(AND(COUNTIF($B3:$B$701,$B3)>COLUMN(A1),COUNTIF($B$3:$B$701,$B3)=COUNTIF($B3:$B$701,$B3)),INDIRECT("$C"&COLUMN(D1)),"")

    You can then copy and paste special>values to remove the formulas, Filter on Column D to delete duplicates and use concatinate to put them in single cells. Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    First of all, thanks for the super quick reply!
    Ok, I'm a little confused, you're saying:
    Paste the formula into D3? Whenever I try this I get an error from Excel saying there is something wrong in the formula.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    When the formula is posted, the forum automatically puts a space every 50 characters (anti spam I think). Remove the space in INDIRECT.

  5. #5
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    I get the result in the attached image. I have to be doing something wrong.
    Attached Images Attached Images

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    Sorry, mistake in my formula. In D3

    =IF(AND(COUNTIF($B3:$B$701,$B3)>COLUMN(A1),COUNTIF($B$3:$B$701,$B3)=COUNTIF($B3:$B$701,$B3)),INDIRECT("$C"&COLUMN(D1)+ROW(B3)-3),"")

    See attachment.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    That works well if a street name has only 2 page numbers associated with it, however, if there are 3 page numbers associated with a street it does not work. See attached image for "Bayou St." It has three page numbers associated with it.
    Thanks.
    Attached Images Attached Images

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Dissolve One Field, Append to another

    If either

    a) you wish concatenate into one string

    b) you wish to purge data post "consolidation"

    You would be better off using VBA.

    If, however, you wish to leave the original listing as is and simply generate an alternate view of the same data then perhaps the attached will be of interest ?
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    Floyd, did you look at my attachment? It looks like you didn't drag the formula to the right.

  10. #10
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    That worked! Thank you so much!

  11. #11
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    Chemist,

    Before I concatenate the fields, how do I get rid of the duplicate records? In the attachment you see Aaron St has two records, I only want to keep the first one. Is there a way to go through and delete all the extras? Thanks.
    Attached Images Attached Images

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    See this thread

    http://www.excelforum.com/excel-gene...tire-rows.html

    In D3 dragged down, using this formula instead
    =IF(B2&C2=B3&C3,"Delete","Keep")
    Hope that helps.

  13. #13
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    Ok, I see your logic here, however when there are more than two duplicate records it says "Keep" even though it should be deleted. How would I use this formula for multiple duplicate records.

  14. #14
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dissolve One Field, Append to another

    No, it should work as long as the entries are in order(ie. for a single street don't have E3, D3, E3, D3 It should be D3, D3, E3, E3). I checked "Asbury Lane" for example, has 2 deletes. The formula should be comparing the data in that row to the data in the previous row.

  15. #15
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    Chemist,

    Sorry it took so long for me to reply, lots of work for the end of fiscal year. Anyways, attached is the result I get with the code:

    =IF(B2&C2=B3&C3,"Delete","Keep")

    Everything seems to be a "Keep." Also, how does it account for the other columns (D,E,F,G,H)?

    Thanks.
    Attached Images Attached Images

  16. #16
    Registered User
    Join Date
    03-25-2010
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Dissolve One Field, Append to another

    Nevermind, I got it. Thank you sooo much!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1