+ Reply to Thread
Results 1 to 8 of 8

VBA to extract data to a single row

  1. #1
    Registered User
    Join Date
    02-15-2016
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    4

    Post VBA to extract data to a single row

    Hi Everyone,

    I got a problem on our timekeeping logs. Logs been printed as below:

    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In
    PD OPERATOR Cruz, Maria 4/1/2019 8:07:57 PM 040119 C/Out
    PD OPERATOR Cruz, Maria 4/2/2019 6:56:09 AM 040219 C/In
    PD OPERATOR Cruz, Maria 4/2/2019 7:02:25 PM 040219 C/Out
    PD OPERATOR Pablo, Juan 4/1/2019 9:40:10 AM 040119 C/In
    PD OPERATOR Pablo, Juan 4/1/2019 8:01:02 PM 040119 C/Out
    PD OPERATOR Pablo, Juan 4/2/2019 6:16:44 AM 040219 C/In
    PD OPERATOR Pablo, Juan 4/2/2019 7:31:32 PM 040219 C/Out

    I want the C/Out of Maria on row 2 on April 1 2019 should be in row of Maria on C/In. Below is the output:

    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In 4/1/2019 8:07:57 PM 040119 C/Out
    PD OPERATOR Cruz, Maria 4/2/2019 6:56:09 AM 040219 C/In 4/2/2019 7:02:25 PM 040219 C/Out
    PD OPERATOR Pablo, Juan 4/1/2019 9:40:10 AM 040119 C/In 4/1/2019 8:01:02 PM 040119 C/Out

    Is this possible on VBA? Any advice and help really appreciated. Thank you very much

  2. #2
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: VBA to extract data to a single row

    @garyperegrino - do you really need VBA ?
    check if the attached file which is combination of table with formulas and pivot table that gives you flexibility
    Attached Files Attached Files
    Truth fears no questions.

  3. #3
    Registered User
    Join Date
    02-15-2016
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    4

    Re: VBA to extract data to a single row

    Hi Godlev - This is the format of my excel.

    Column A Column B Column C Column D Column E
    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In
    PD OPERATOR Cruz, Maria 4/1/2019 8:07:57 PM 040119 C/Out
    PD OPERATOR Cruz, Maria 4/2/2019 6:56:09 AM 040219 C/In
    PD OPERATOR Cruz, Maria 4/2/2019 7:02:25 PM 040219 C/Out
    PD OPERATOR Pablo, Juan 4/1/2019 9:40:10 AM 040119 C/In
    PD OPERATOR Pablo, Juan 4/1/2019 8:01:02 PM 040119 C/Out
    PD OPERATOR Pablo, Juan 4/2/2019 6:16:44 AM 040219 C/In
    PD OPERATOR Pablo, Juan 4/2/2019 7:31:32 PM 040219 C/Out

    Then the output should be like this.

    Column A Column B Column C Column D Col E Column F Column G Column H
    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In 4/1/2019 8:07:57 PM 040119 C/Out
    PD OPERATOR Cruz, Maria 4/2/2019 6:56:09 AM 040219 C/In 4/2/2019 7:02:25 PM 040219 C/Out
    PD OPERATOR Pablo, Juan 4/1/2019 9:40:10 AM 040119 C/In 4/1/2019 8:01:02 PM 040119 C/Out

    Just need to move the C/out of Maria aligned to C/In on per date basis.

    Thank you very much for your support.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: VBA to extract data to a single row

    If the data as shown is (I did not download your attachment) in Column A and starts at the 2nd Row, put this formula in B2.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy and paste the formula to every 2nd Row after this (B4, B6, B8 etc)
    Copy all of Column B and paste again as values.
    Delete the odd Rows (3, 5, 7 etc)
    If you want this done with code, let us know.

  5. #5
    Registered User
    Join Date
    02-15-2016
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    4

    Re: VBA to extract data to a single row

    Hi Jolivanes, Thank you for your response. Yes I want it done with a code. But these data is separated on every column:

    Column A Column B Column C Column D Column E
    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In
    PD OPERATOR Cruz, Maria 4/1/2019 8:07:57 PM 040119 C/Out
    PD OPERATOR Cruz, Maria 4/2/2019 6:56:09 AM 040219 C/In
    PD OPERATOR Cruz, Maria 4/2/2019 7:02:25 PM 040219 C/Out
    PD OPERATOR Pablo, Juan 4/1/2019 9:40:10 AM 040119 C/In
    PD OPERATOR Pablo, Juan 4/1/2019 8:01:02 PM 040119 C/Out
    PD OPERATOR Pablo, Juan 4/2/2019 6:16:44 AM 040219 C/In
    PD OPERATOR Pablo, Juan 4/2/2019 7:31:32 PM 040219 C/Out

    If Maria has C/Out on The same date, it will move this row on C/IN row like this one:

    Column A Column B Column C Column D Col E Column F Column G Column H
    PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In 4/1/2019 8:07:57 PM 040119 C/Out

    THank you very much for your support.
    Last edited by garyperegrino; 04-11-2019 at 09:30 PM.

  6. #6
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: VBA to extract data to a single row

    did you check the attachment ?

  7. #7
    Registered User
    Join Date
    02-15-2016
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    4

    Re: VBA to extract data to a single row

    Hi godlev, Yes I already checked it. On the attachment, on this data - "PD OPERATOR Cruz, Maria 4/1/2019 6:56:28 AM 040119 C/In" it is on one column only.

    My data is separated by columns. Please checked attached timekeeping file. Thank you for your utmost support.
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,635

    Re: VBA to extract data to a single row

    This proposal employs three helper columns (F2:H15) which may be moved and/or hidden for aesthetic purposes.
    The helper columns are populated using: =IF(OR($A2="",$E3="",$E3="C/In"),"",C3)
    The output (K2:R15) is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] Extract data from single cell
    By XLalbania in forum Excel General
    Replies: 5
    Last Post: 07-16-2016, 10:03 AM
  2. extract data from 2 sheets to single sheet
    By sumonrezadu in forum Excel General
    Replies: 3
    Last Post: 01-31-2014, 10:26 AM
  3. [SOLVED] Extract single cell data based on a single cell entry
    By farmerdoode in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 11:11 PM
  4. How to extract charts and data into single view?
    By toplisek in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-01-2013, 11:54 AM
  5. extract data based on single criteria
    By auntiet in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-31-2013, 07:22 PM
  6. Extract comumn data into single field
    By lavaghman1 in forum Excel General
    Replies: 2
    Last Post: 02-21-2012, 01:54 AM
  7. Extract multiple data into single cells
    By vijsachin in forum Excel General
    Replies: 3
    Last Post: 03-20-2009, 07:52 AM

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