+ Reply to Thread
Results 1 to 30 of 30

Organizing Data with Excel

  1. #1
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Organizing Data with Excel

    Hello,

    I am looking for a way to create a spreadsheet that can be used as a template for organizing data. This spreadsheet needs to be able to receive data and add two columns (which can be done with a macro) and also rearrange the same columns every time. I would like this spreadsheet to be able to fill in blanks of a new column based on information given in another column. How would I go about doing this?

    Also, is there a way for it to read data from one column and if it is within a certain range, then output a specific value in a new column?

    Any help is greatly appreciated!

    Thanks.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    Welcome to the Forum! The best way is to start -Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    A little more detail now that the Before and After spreadsheets are uploaded. I am looking for a way to get from the before to the after. I want to be able to paste data in a spreadsheet and it makes it look like the After spreadsheet either in a new document (if possible) or at least a new sheet.

    To get to the after from the before, the following steps take place:
    -Size and Product columns are inserted
    -The columns are rearranged to be in the order: user status, TechIdentNo.,Size,Product,ConstructYear,Description,Equipment,Manufacturer,Start-up date, AP Design option (the rest stay in same order)
    -Anything in the TechIdenNo. column that contains a "LH" gets "Hydrogen" in the Product column
    -Anything in the TechIdenNo. column that contains a "T" gets deleted from the data
    -The remaining in TechIdenNo. get "Atmospheric" in the Product column
    -From the water volume column, the size column gets populated using this table as a reference:
    0-1000 G = 500 G
    1,001 G – 2,000 G = 1,500 G
    2,001 G – 4,000 G = 3,000 G
    4,001 G – 8,000 G = 6,000 G
    8,001 G – 10,000 G = 9,000 G
    10,001 G – 12,000 G = 11,000 G
    12,001 G – 14,000 G = 13,000 G
    14,001 – 20,000 G = 15,000 G
    > 15,000 G

    for example...if the water volume is 9,000 G then "9000" would go in the size column
    if the water volume is 12,500 then "13,000" would go in the size column (omit G from size column)


    These are the steps I would like it to perform. Is this possible? Thanks so much for the help!

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    This "after" differs from your posted "after" ??

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name

  5. #5
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Thank you for the help! I am getting an error when I try and run the Macro "Run-time error '9':
    Subscript out of range

    I cut out a lot of the data when I posted the Before and After spreadsheet for simplicity. If you need me to post one with more information in it please let me know!

  6. #6
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Wow thank you! I see this macro worked on the "before" that I uploaded. Would it be possible to make it work on a spreadsheet with this much data? (as I have attached. Also, could something be added to the end of the Macro that makes the color scheme the same as in the "After" I uploaded and also automatically turn filters on? Again, thank you very much!
    Last edited by csincava; 07-02-2015 at 02:57 PM.

  7. #7
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    I apologize for so many responses, but instead of filling in CO2 for tanks that have a "T" under the TechIdentNo. can those actually be deleted completely? You have no idea how much this is helping me I appreciate it very much!

    *I tried to delete this post, but I could not figure out how. I realized it already does this so just wanted to say to disregard the CO2 part of the post. I really do appreciate the help though.
    Last edited by csincava; 07-02-2015 at 08:35 AM. Reason: Correction

  8. #8
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Last request I have on this code. Is there a way it could automatically auto fit the columns to fit the contents? Thanks!!!

  9. #9
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Whenever the AFTER spreadsheet opens, there is an error I am getting with this line:
    V = Left(wa.Cells(i, 29), InStrRev(wa.Cells(i, 29), ".") + 2)

    Can this If statement be modified so that if the water volume column is blank, then it prints "Not available" or something in the Size column. I think it is having trouble interpreting the blank in the water volume column.

  10. #10
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Whenever the AFTER spreadsheet opens, there is an error I am getting with this line:
    V = Left(wa.Cells(i, 29), InStrRev(wa.Cells(i, 29), ".") + 2)

    Can this If statement be modified so that if the water volume column is blank, then it prints "Not available" or something in the Size column. I think it is having trouble interpreting the blank in the water volume column.

  11. #11
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    I don't think the code is deleting items with a "T" in them from the TechidentNo. so this might be causing some of the problem?

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    Thanks for the rep!

    Try this and let me know:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    It looks great!! Some of the items with a "T" under the TechIdentNo. column are showing as Atmospheric though. (Row 692 and 693 for example). Any idea why this might be happening or any thoughts on how to fix? Also, can the rows containing "TK" also be removed from this column? if we can get those two issues figured out it will be perfect!

  14. #14
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    When the new document is presented, is there a quick way that the columns can already have filters put on them? I can't thank you enough for looking into this with me.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    Are you part of the Excel Forum team? Do I need to buy any points or anything to finish my request? You have helped me greatly!
    I'm a contributor who has been honored with Guru status. This forum is a free service although we do have a commercial service where you can buy points etc. However, that is not necessary in this case - try this and let me know

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    I believe this works! I will let you know if I stumble upon any issues. Again, I can't thank you enough for all of your help! I might have some minor macro Excel questions in the future that I will probably ask you if that is alright.

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    Of course it's alright to ask me about the routine and I'm glad that it's working!

  18. #18
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Hello xladept,

    I have one more request for help from you if that is alright. I believe this is a much simpler task. I have a spreadsheet that I have attached as BEFORE. I want to be able to go down column D and insert a number. Based on this number I insert, the Total (Column I) updates with pricing information. I am looking for a way so that each row I update column D with gets pasted in a new sheet in the same workbook. I have also attached an AFTER spreadsheet to clarify what I mean. If possible, I also want the data that gets put in the new sheet to be summed up in a "TOTAL" box where column I is summed up and also the 3% markup price is shown. I am also trying to get the same size columns on the second sheet as they did in the initial sheet. This BEFORE spreadsheet could have new rows being added in over time and I want a way for them to be able to be added to the new sheet as well if a number greater than 0 is inserted into column D. Is this something that can be done? Thank you for your help!
    Last edited by csincava; 07-22-2015 at 02:17 PM. Reason: Accidently submitted early

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Try this:

    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Hey thank you so much for looking at this! Nothing happened when I ran this macro though.

  21. #21
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    I spoke too soon...this is fantastic! Thank you!

  22. #22
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Is there a simple add in that can be used to make the rows the same size as they are on the first sheet? Other than that this looks great and I really appreciate it!

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Maybe:

    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Is it possible for the items to have the exact same size as they do on Sheet 1 or do they have to be auto-fitted and preset with a specific row height? If this is the way it has to be that is totally okay and I want to thank you very much for your help again. This will work great!

  25. #25
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Maybe:

    Please Login or Register  to view this content.

  26. #26
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  27. #27
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Hello,

    I have attached the code that I have been using, but I am wondering if I could change something. Right now it is set up to delete everything in one column that has a "T". I was wondering if this can be modified so that now everything with a "T" gets "CO2" put into the "Product" column that we have getting inserted.


    Option Explicit
    Sub Organizer(): Dim wb As Worksheet, wa As Worksheet, r As Long, i As Long, V As Long
    Set wb = Workbooks("Organize.xlsm").Sheets("Sheet1")
    r = wb.Range("A" & Rows.Count).End(xlUp).Row
    Workbooks.Add: ActiveWorkbook.SaveAs wb.Parent.Path & "\" & "DATE IDLE TANKS.xlsx"
    Set wa = Workbooks("DATE IDLE TANKS.xlsx").Sheets("Sheet1")

    wb.Cells.Copy: wa.Range("A1").PasteSpecial xlPasteFormats
    wa.Range("Z1").Resize(1, 2).Copy
    wa.Range("AB1").PasteSpecial xlPasteFormats

    wa.Range("A1").Resize(r, 1).Value = wb.Range("A1").Resize(r, 1).Value
    wa.Range("C1") = "SIZE": wa.Range("D1") = "PRODUCT"
    wa.Range("B1").Resize(r, 1).Value = wb.Range("G1").Resize(r, 1).Value
    wa.Range("E1").Resize(r, 5).Value = wb.Range("B1").Resize(r, 5).Value
    wa.Range("J1").Resize(r, 20).Value = wb.Range("H1").Resize(r, 20).Value

    For i = 2 To r
    If wa.Cells(i, 2) <> "" Then wa.Cells(i, 4) = "Atmospheric"
    If InStr(1, wa.Cells(i, 2), "T") Then
    wa.Rows(i).Delete Shift:=xlUp: i = i - 1: GoTo GetNext: End If
    If InStr(1, wa.Cells(i, 2), "LH") Then wa.Cells(i, 4) = "Hydrogen"

    If InStr(1, wa.Cells(i, 29), ".") Then
    V = Left(wa.Cells(i, 29), InStrRev(wa.Cells(i, 29), ".") + 2)
    If V > 20000 Then
    V = V
    ElseIf V > 14000 Then
    V = 15000
    ElseIf V > 12000 Then
    V = 13000
    ElseIf V > 10000 Then
    V = 11000
    ElseIf V > 8000 Then
    V = 9000
    ElseIf V > 4000 Then
    V = 6000
    ElseIf V > 2000 Then
    V = 3000
    ElseIf V > 1000 Then
    V = 1500
    Else
    V = 500
    End If
    wa.Cells(i, 3) = V
    End If
    GetNext: Next i
    wa.Columns.AutoFit: wa.Columns.AutoFilter
    End Sub

  28. #28
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Try this:

    Please Login or Register  to view this content.
    *Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    *AND please start a new thread the next time.

  29. #29
    Registered User
    Join Date
    07-01-2015
    Location
    United States
    MS-Off Ver
    2007
    Posts
    23

    Re: Organizing Data with Excel

    Hey xladept,

    I am looking for a way to utilize this code, however the data is being brought into the spreadsheet in a new order and I am not sure how to get the PRODUCT and SIZE columns to adjust to these changes. Would you be able to modify the code so that it is able to do the same thing as before, but with the columns in this order? Thank you so much!
    Attached Files Attached Files

  30. #30
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Organizing Data with Excel

    Hi csincava,

    It looks like we only had to include three extra fields at the end - but, Check it out:

    Please Login or Register  to view this content.
    *I renamed the before book "csincavaIII.xlsx"

+ 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. Replies: 10
    Last Post: 01-12-2015, 01:19 AM
  2. Organizing Data
    By ncstate in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 08-07-2013, 01:49 PM
  3. A straightforward question about organizing data in Excel
    By n_ant in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-28-2013, 03:27 PM
  4. Replies: 5
    Last Post: 03-30-2009, 08:08 AM
  5. [SOLVED] Problem organizing text data into new excel page
    By Tony in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-21-2005, 04:05 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