+ Reply to Thread
Results 1 to 12 of 12

Extract moving information from Sheet1 and put it on Sheet2

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Extract moving information from Sheet1 and put it on Sheet2

    I need to extract information from Sheet1 and put it on Sheet2. The report for Sheet1 is never the same. I need to extract information from each column separately, based on values in one or more cells and put the results on Sheet2. The Values that I want to reference to never changes, except that they might not be there if the equipment did not run. Also need to search on each column separately, so I do not combine the results.

    I have 4 different, but similar examples and need each to have its own Macro:

    1) In this scenario I want to search for the values ADAM, Break, 15, and PCS will always be there, values Break, 15, and PCS will always follow in that order next to each other. In Column A there is ADAM in cell “A3” identifying the equipment, in column “A21” is Break, value never changes, location in column does. In column “A22” is 15, below that in “A23” is PCS, in “A24” is 15275(that value changes) and is what I need to copy to Sheet2 in a cell location that never changes. Next in cell “A28” is Thpt, that value never changes and in cell “A29” is 8825, that value changes and I need to copy it to Sheet2 in a cell location that never changes.

    2) In this scenario I want to search for the values ADAM200, Break, 4, 7, and PCS will always be there, values Break, 4, 7, and PCS will always follow in that order next to each other. In Column A there is ADAM200 in cell “A69” identifying the equipment, in column “A152” is Break again, value never changes, location in column does. In column “A171 & A172” is 4 & 7 that order, below that in “A173” is PCS, in “A174” is 97149(that value changes) and is what I need to copy to Sheet2 in a cell location that never changes. Next in cell “A183” is Thpt, that value never changes and in cell “A184” is 20264, that value changes and I need to copy it to Sheet2 in a cell location that never changes. Note in “A178” is Pcs and “A188” is Thpt, I need to ignore them.


    3) In this scenario I want to search for the values ARIAL300, 146P0002, JOB 146, and Break, will always be there, I need to search between the values ARIAL300, and Break. I need to find 146P0002 at “A236” and Job 146 at “A238”, will never be in the same location but will always be one cell apart in that order. I need to copy the values from cells “A237” and “A240”, which is always located in the same cells in reference to 146P0002 and Job 146 to Sheet2 in a cell location that never changes.

    4) In this scenario I want to search for the values ARIAL300, 143P0022, JOB 143, and Break, will always be there, I need to search between the values ARIAL300, and Break. I need to find 143P0022 at “C380” and Job 143 at “C382”, will never be in the same location but will always be one cell apart in that order. I need to copy the values from cells “C381” and “C383”, which is always located in the same cells in reference to 143P0022 and Job 143 to Sheet2 in a cell location that never changes. The only additional thing may happen is there could be more than one instance of values 143P0022 and Job 143 between ARIAL300, and Break. In that case I need to sum the values together. Like “C381”(17,177 Pcs), “C386”(115 Pcs), “C438”(31,069 Pcs), “C443”(28,340 Pcs), & “C448”(3,074 Pcs) Totaling 79775, Next I need to total the time from cells “C383”(1:33:45), “C388”(0:06:49), “C440”(2:57:09), “C445”(3:48:10), & “C450”(0:46:40) totaling 33,153 seconds. Then divide 79775 by 33153 and multiply it by 3600, equaling 8662.56447, then round it off to 8663 P/Hr. Note: If I try to average the times any other way it does not match the original report.
    Attached Files Attached Files
    Last edited by dgfl; 05-02-2013 at 01:08 AM. Reason: Update information and upload new attachment.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: I need to extract information from Sheet1 and put it on Sheet2

    Please update your sample workbook. Along with your verbal explanation, SHEET2 should be a mockup of your desired results based on the Sheet1 sample data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    I need to extract information from Sheet1 and put it on Sheet2. The report for Sheet1 is never the same. I need to extract information from each column separately, based on values in one or more cells and put the results on Sheet2. The Values that I want to reference to never changes, except that they might not be there if the equipment did not run. Also need to search on each column separately, so I do not combine the results.

    I have 4 different, but similar examples and need each to have its own Macro:

    1) In this scenario I want to search for the values ADAM, Break, 15, and PCS will always be there, values Break, 15, and PCS will always follow in that order next to each other. In Column A there is ADAM in cell “A3” identifying the equipment, in column “A21” is Break, value never changes, location in column does. In column “A22” is 15, below that in “A23” is PCS, in “A24” is 15275(that value changes) and is what I need to copy to Sheet2 in a cell location that never changes. Next in cell “A28” is Thpt, that value never changes and in cell “A29” is 8825, that value changes and I need to copy it to Sheet2 in a cell location that never changes.

    2) In this scenario I want to search for the values ADAM200, Break, 4, 7, and PCS will always be there, values Break, 4, 7, and PCS will always follow in that order next to each other. In Column A there is ADAM200 in cell “A69” identifying the equipment, in column “A152” is Break again, value never changes, location in column does. In column “A171 & A172” is 4 & 7 that order, below that in “A173” is PCS, in “A174” is 97149(that value changes) and is what I need to copy to Sheet2 in a cell location that never changes. Next in cell “A183” is Thpt, that value never changes and in cell “A184” is 20264, that value changes and I need to copy it to Sheet2 in a cell location that never changes. Note in “A178” is Pcs and “A188” is Thpt, I need to ignore them.


    3) In this scenario I want to search for the values ARIAL300, 146P0002, JOB 146, and Break, will always be there, I need to search between the values ARIAL300, and Break. I need to find 146P0002 at “A236” and Job 146 at “A238”, will never be in the same location but will always be one cell apart in that order. I need to copy the values from cells “A237” and “A240”, which is always located in the same cells in reference to 146P0002 and Job 146 to Sheet2 in a cell location that never changes.

    4) In this scenario I want to search for the values ARIAL300, 143P0022, JOB 143, and Break, will always be there, I need to search between the values ARIAL300, and Break. I need to find 143P0022 at “C380” and Job 143 at “C382”, will never be in the same location but will always be one cell apart in that order. I need to copy the values from cells “C381” and “C383”, which is always located in the same cells in reference to 143P0022 and Job 143 to Sheet2 in a cell location that never changes. The only additional thing may happen is there could be more than one instance of values 143P0022 and Job 143 between ARIAL300, and Break. In that case I need to sum the values together. Like “C381”(17,177 Pcs), “C386”(115 Pcs), “C438”(31,069 Pcs), “C443”(28,340 Pcs), & “C448”(3,074 Pcs) Totaling 79775, Next I need to total the time from cells “C383”(1:33:45), “C388”(0:06:49), “C440”(2:57:09), “C445”(3:48:10), & “C450”(0:46:40) totaling 33,153 seconds. Then divide 79775 by 33153 and multiply it by 3600, equaling 8662.56447, then round it off to 8663 P/Hr. Note: If I try to average the times any other way it does not match the original report.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract moving information from Sheet1 and put it on Sheet2

    Try these formulas:

    B4: =INDEX(Sheet1!A$4:A$1004, MATCH("Break15PCS", INDEX(Sheet1!A$1:A$1001&Sheet1!A$2:A$1002&Sheet1!A$3:A$1003, 0), 0))
    B5: =INDEX(Sheet1!A:A, MATCH("ADAM", Sheet1!A:A, 0)+13)

    I4: =INDEX(Sheet1!A$4:A$1004, MATCH("47PCS", INDEX(Sheet1!A$1:A$1001&Sheet1!A$2:A$1002&Sheet1!A$3:A$1003, 0), 0))
    I5: =INDEX(OFFSET(Sheet1!A$1,MATCH("47PCS", INDEX(Sheet1!A$1:A$1001&Sheet1!A$2:A$1002&Sheet1!A$3:A$1003, 0), 0), , 100, ), MATCH("Thpt", OFFSET(Sheet1!A$1,MATCH("47PCS", INDEX(Sheet1!A$1:A$1001&Sheet1!A$2:A$1002&Sheet1!A$3:A$1003, 0), 0), , 100, ), 0)+1)

    B14: =SUBSTITUTE(INDEX(Sheet1!A:A, MATCH("146P0002",Sheet1!A:A, 0)+1), " Pcs", "")+0
    B15: =SUBSTITUTE(INDEX(Sheet1!A:A, MATCH("JOB 146",Sheet1!A:A, 0)+2), " P/Hr", "")+0

    These next two formulas are array formulas:
    D18: =SUMPRODUCT(IF(INDEX(Sheet1!C$1:C$1001&Sheet1!C$3:C$1003,0)= "143P0022Job 143", SUBSTITUTE(Sheet1!C$2:C$1002, " Pcs", "")+0,0))
    D19: =ROUND((D18/(SUMPRODUCT(IF(INDEX(Sheet1!C$1:C$1001&Sheet1!C$3:C$1003,0)= "143P0022Job 143", Sheet1!C$4:C$1004))*86400))*3600,0)

    ...confirmed these in the cell by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  5. #5
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    This was very helpfull, except I came across another scenario that I need help on.

    5) In this scenario I want to search for the values ARIAL300”C363”, Volume”C525”, Thrput”C526”, and Tour”C527”, it will always be there. Value ARIAL300”C363” will always be first, then the values Volume”C525”, Thrput”C526”, and Tour”C527” will follow in that order next to each other some were before the next equipment’s information. Above Volume”C525” is cells “C491”(32973) and “C506”(6116), which is the values I need to copy to Sheet2 in cell locations “D22” and “D23”. Note that “Volume, Thrput, and Tour” is repeated in other places after other equipment names. So the search needs to find the equipment name first before it finds “Volume, Thrput, and Tour” together below it or if it finds “Volume, Thrput, and Tour” first then it needs to look above it for the equipment name. I updated the attachment to reflect this problem.

    Thanks so far for the help.
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract moving information from Sheet1 and put it on Sheet2

    There needs to be some logic to exactly WHERE Excel looks up to find the values desired up above.

    1) Find ARIAL300
    2) Search below that for Thrput (looks like this is unique, all the other are Thpt)
    3) Look UP from there 20 cells to get 6116, look up 35 cells to get 32973

    Will that work? If not, you need to rethink steps 2 & 3 above, Excel needs something that targets it accurately to the FINAL cell.

  7. #7
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    Yes, that will work as long as it looks at ARIAL300 first then reference up from the first Thrput that it sees, since there is others below it.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract moving information from Sheet1 and put it on Sheet2

    I thought #2 might work, but #3? Are those cells always 20 cells above Thrput and 35 cells above Thrput? If not, you will have to describe the unique logic that allows us to spot those specific values and not others.

  9. #9
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    6) I am having a problem with the formulas not returning a result, only “#VALUE!”. Below is an example of the formula that I am using. It will work for one column, but not the next. If I change “893SHSTD” to something else like “893SHATD” and change all the values in the column that I am searching on from “893SHSTD” to “893SHATD”, it will work.

    Example =SUMPRODUCT(IF(INDEX(Import!I$1:I$10001,0)= "893SHSTD", SUBSTITUTE(Import!I$2:I$10002, " Pcs", "")+0,0))

    I did try confirming these in the cell by pressing CTRL-SHIFT-ENTER to activate the array and Press F2 on that cell and tried it again several times, did not help.

    7) My next problem is their anyway of using wildcards to search on values starting with the same values. I tried “893S*”, and “893S?”, they would not work. Below is a example.

    Example =SUMPRODUCT(IF(INDEX(Import!I$1:I$10001,0)= "893S?", SUBSTITUTE(Import!I$2:I$10002, " Pcs", "")+0,0))

    Note; I do not no if size has any bearing on this, anyway this is the size of the Excel sheet that I am searching on, A thru O for columns & 1 thru 3500 rows so far.

    Thanks again for your help.
    Last edited by dgfl; 06-01-2013 at 04:53 AM.

  10. #10
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    8) I found the problem with example “6”, I have the value “893SHSTD” repeated in the next row below in the same column, so it will not return a value. So now I need to figure out how to ignore the row below if it does not have a true value or away to rename the one above if the one below is the same name so it does not look for the value “893SHSTD”. Reference cell I15 on Sheet2 and cells I1 thru I26 on Sheet1. See attached example.

    Example =SUMPRODUCT(IF(INDEX(Import!I$1:I$10001,0)= "893SHSTD", SUBSTITUTE(Import!I$2:I$10002, " Pcs", "")+0,0))
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-25-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Extract moving information from Sheet1 and put it on Sheet2

    I really appreciate your help; I have posted some additional problems that I am having. Could you please look at problem 7 & 8?

    Thanks again.
    Last edited by dgfl; 05-23-2013 at 12:26 AM.

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract moving information from Sheet1 and put it on Sheet2

    7) No, offhand I don't know any way to make a wildcard work with info given. What are the expected results?

    8) That formula takes the cell below each instance of 893SHSTD and sums the NUMBER in the cell below after stripping out the " Pcs". Obviously the 4 extra ones at the bottom aren't working. Hmm....

    Guess we need to test for and remove the errors created by the non-numerics.

    Array:

    =SUM(IF(ISNUMBER(IF(INDEX(Sheet1!I$1:I$1000,0)= "893SHSTD", SUBSTITUTE(SUBSTITUTE(Sheet1!I$2:I$1001, " Pcs", "")+0, "893HSTD", 0)+0,0)), IF(INDEX(Sheet1!I$1:I$1000,0)= "893SHSTD", SUBSTITUTE(SUBSTITUTE(Sheet1!I$2:I$1001, " Pcs", "")+0, "893HSTD", 0)+0,0)))

+ 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