+ Reply to Thread
Results 1 to 6 of 6

Excel 2010 Merging two documents and adding lines based on criteria

  1. #1
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Excel 2010 Merging two documents and adding lines based on criteria

    Hi I am not sure if this is the right subform but my query is this I have a list of extension numbers and in the next column I put =IF(A3-A2=1,"Not Free","Extension" & " " & A2 + 1 & " is free") but now what I want to do is merge a seperate spreadsheet that has the name of who is assigned to these extension numbers and add it the third column and once that is done I would to automaticly create a new line add in the name of the free extension and then replace the code in the second column with just free extension is that possible?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: Excel 2010 Merging two documents and adding lines based on criteria

    You can use VLOOKUP or an INDEX/MATCH combination to get the name from the second sheet. Attach a sample workbook to show the way your data is laid out and to explain more clearly what you want to achieve.

    Pete

  3. #3
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Excel 2010 Merging two documents and adding lines based on criteria

    Thank you for the reply. Ok on the attached the first sheet has a list of extensions with gaps which I used a code to find the gaps and the second sheet has extensions with names. Now these would be two seperate spreadsheets but for a example I have made them into one. So What I want to do is take those names from the second sheet and put them next to the matching number on the first. Then if you see the code in the second column of the first spreadsheet I want to make a new row take the extension from the code and placing it in column A of the new row and in column B of the new row put "Free extension". Hopefully that makes sense I am finding it difficult to explaine
    example.xlsx

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: Excel 2010 Merging two documents and adding lines based on criteria

    You can use this formula in C2:

    =IFERROR(VLOOKUP(A2,'List of Names'!A:C,3,0),"")

    A formula can't insert a row, so you would need some macro to achieve that.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Excel 2010 Merging two documents and adding lines based on criteria

    Thank you very much that worked like a charm

  6. #6
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Excel 2010 Merging two documents and adding lines based on criteria

    I found this code
    Sub InsertRows()
    Dim x As Long, y As Long
    For x = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    y = Range("A" & x) - Range("A" & x - 1)
    If y > 1 Then Range("A" & x).Resize(y - 1).EntireRow.Insert xlShiftDown
    Next
    End Sub
    which inserts empty cells everytime it detects a gap do you know how I can modifiy it to add the number in?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Merging two documents without adding unique rows
    By ajpl in forum Excel General
    Replies: 9
    Last Post: 05-07-2013, 03:03 AM
  2. Merging Excel Documents
    By lphan in forum Excel General
    Replies: 2
    Last Post: 02-15-2013, 02:57 PM
  3. Excel 2010-Formating based on criteria
    By Toomay in forum Excel General
    Replies: 2
    Last Post: 08-15-2011, 11:39 AM
  4. merging 2 excel documents
    By canberry in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 02-06-2009, 05:43 PM
  5. Merging multiple excel documents into one.
    By spyrule in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2008, 03:16 PM

Tags for this Thread

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