Solved

Mass move info in Excel File

Posted on 2013-12-11
4
309 Views
Last Modified: 2013-12-12
I have a large Excel file that contains some data in it horizontally, that I need changed to vertically.  Not as simple as I just said, so I will try to explain.  The original file has a unique p21lot number in column A, then a letter symbol that represents a chemical in column B, then a number in column C which is the actual number of the chemical in column B.  Column D would have the next chemical abbreviation, Column E would have the actual number for the chemical in column D, etc., etc.  Some p21 lot numbers have a couple of chemicals, while others may have 16.  In my sample, you may notice that it appears that the chemicals are always in the same location.....C is the first one, MN is the second, etc. but this is NOT the case.  So using a pivot table was not a solution for me.  What I need to do with this information is  have column A display the p21 lot number, column b show the chemical name and column c show the actual result. So there would be multiple rows with the same p21 lot number based on the number of chemicals.
I'd like to know if someone knows of an easy way to do this.  I have 5000 lot numbers that need this done and doing it by hand is not only going to be time consuming but I fear I would make errors.
I have attached a sample.  One tab has current data and the other tab shows what I need it to look like.
EE-Sample.xlsx
0
Comment
Question by:ITworks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 4

Author Comment

by:ITworks
ID: 39712373
current data
0
 
LVL 4

Author Comment

by:ITworks
ID: 39712374
what i need
0
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39713544
Hi,

pls try

Sub macro()
Application.ScreenUpdating = False
myCalc = Application.Calculation
Application.Calculation = xlCalculationManual
    ActiveWorkbook.Worksheets("Current").Copy After:=Sheets(Sheets.Count)
    Set ResultSht = Sheets(Sheets.Count)
    ResultSht.Name = "Result"
    With Cells.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Rows("1:1").Delete Shift:=xlUp
    Range("B1").Value = "CHEM"
    Range("C1").Value = "ACTUAL"
    Range("D1").Resize(1, 256).ClearContents
    Set RowCell = Range("A2")
    Do Until RowCell.Value = ""
        Set ColCell = RowCell.Offset(0, 3)
        Do Until ColCell = ""
                RowCell.EntireRow.Copy
                RowCell.Offset(1, 0).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
                RowCell.Offset(0, 3).Resize(1, 256).ClearContents
                RowCell.Offset(1, 1).Resize(1, 2).Delete Shift:=xlToLeft
                Set RowCell = RowCell.Offset(1, 0)
                Set ColCell = RowCell.Offset(0, 3)
        Loop
        Set RowCell = RowCell.Offset(1, 0)
        Set ColCell = RowCell.Offset(0, 3)
    Loop
    For Idx = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
        If Cells(Idx, 3) = "" Then
            Cells(Idx, 3).EntireRow.Delete
        End If
    Next
Application.Calculation = myCalc
Application.ScreenUpdating = True
End Sub

Open in new window

Regards
0
 
LVL 4

Author Closing Comment

by:ITworks
ID: 39714147
AWESOME!    You have saved me 40 hours of manual labor of cutting and pasting.   I wish I could award you more points!    Thanks so much!

Sue
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question