+ Reply to Thread
Results 1 to 12 of 12

Advice on copying cells into second tab

  1. #1
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Advice on copying cells into second tab

    I am wondering is is possible to automatically copy a row of data from one table to another table depending on a cell input in the first table.

    Example say table one had the following

    SB | 09:45 | 2L22 | 85425 | 465526 | 1 | 0 |
    SB | 10:05 | 3Q5 | 85456 | 458526 | 1 | 1 |
    JB | 11:00 | 3H55 | 85542 | 465258 | 0 | 0 |
    JB | 11:50 | 2L22 | 85452 | 475625 | 1 | 1 |

    Now I need want JB data and SB data in a separate chart. So can I have a separate table with a function like IF (cell 1 on table 1)= JB (copy this row into table 2 for each row) and then the same for SB in a third table

    Then I could easily do the maths to make a chart on JB data input.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Advice on copying cells into second tab

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Re: Advice on copying cells into second tab

    So I have added an excel attachment. On sheet one the user inputs the data for the day.
    This is extracted into a sum of cells to the right and then on sheet 2 a chart is populated for all
    the data for the current period.
    This all work great but i would like to do what i have mocked up on sheet 3. A chart which would be populated from sheet 1 but
    the data will be shown as individual input data over the current period.
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Advice on copying cells into second tab

    Is this it? In B9, copied down:

    =IFERROR(INDEX(Sheet1!$B$2:$B$55,MATCH(0,INDEX(COUNTIF($B$8:$B8,Sheet1!$B$2:$B$55),0),0)),"")

    and in c9, copied across and down:
    =SUMIF(Sheet1!$B:$B,$B9,Sheet1!N:N)
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,893

    Re: Advice on copying cells into second tab

    What constitutes the current period? How is it identifiable in the source data?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Re: Advice on copying cells into second tab

    The period is not to important, it will just be a 3 month chart produced from the data.

    Glenn

    I believe you have it working with that example It will take me some time to test this on the main sheet. Cant believe you cracked this so quickly.

    Where can I get some information to explain what you have done. I do not understand the code you have used and would like to learn this.

    Thank you for the help

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,893

    Re: Advice on copying cells into second tab

    So the current period is the current month and the previous two? Why not just answer the question???

  8. #8
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Re: Advice on copying cells into second tab

    i thought i did, i was not intending to be rude and if it came across that way i apologise. You have helped me out in the past and i am grateful for you input. i just didn't want the current period to confuse the main question i was trying to get across. The main problem i find with forums is the interpretation of a fred can be wrong.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,893

    Re: Advice on copying cells into second tab

    I did not think you were being rude!

    My point is that if you want a chart to draw from the 'current period', then you need to define what that is. Excel will need to know, so yes, it IS important.

  10. #10
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Re: Advice on copying cells into second tab

    I can see the problem, we normally have this excel as a template and raise one every 3 months then close it down and achieve it, raising a new period. each time from the template and the title for the excel table has the period start and end dates.

    i expect it could be done better but at the moment i am learning just how to pull out the data for each person.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Advice on copying cells into second tab

    I presume that it's this bit you need to understand:

    =IFERROR(INDEX(Sheet1!$B$2:$B$55,MATCH(0,INDEX(COUNTIF($B$8:$B8,Sheet1!$B$2:$B$55),0),0)),"")

    the INDEX in the middle of it is just an Excel "trick" to transform an array formula into a non-array (ordinary) formula, which many users prefer. The unadapted formula is:

    =IFERROR(INDEX(Sheet1!$B$2:$B$55,MATCH(0,COUNTIF($B$8:$B8,Sheet1!$B$2:$B$55),0)),"")

    Being an array formula, it would need to be set using CTRL-SHIFT-Enter.

    At its heart is this bit:



    COUNTIF($B$8:$B8,Sheet1!$B$2:$B$55)

    which returns 1 or 0 depending on whether the value in $B$8:$B8 has previously been found in the range $B$2:$B$55. In B9, the value in B8 (a blank cell - but can be a header) will never previously been found in that range, so it returns a series of 0s. The bit in red returns the row corresponding to the first zero. In B9, it will be the first row. The INDEX bit in cyan returns the corresponding value from column B - in this case BD. When the formula is copied into B9, any cells inthe column containing BD will return a 1 in the countif, so the first row that returns a zero in the countif will be passed to the INDEX function, and KR will be returned.

    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  12. #12
    Registered User
    Join Date
    03-24-2018
    Location
    england
    MS-Off Ver
    office 365
    Posts
    20

    Re: Advice on copying cells into second tab

    Thanks Glenn, i will have to do some studying on this. i like the way this works and its now working well on my main worksheet.

    i will mark this as solver and add reputation cheers

+ 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. Advice on clearing contents of cells
    By neil40 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2017, 06:42 PM
  2. [SOLVED] Copying Formula Issue Advice - I'm SURE there is an easy answer I am overlooking
    By johnnygirl51 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-09-2017, 11:58 AM
  3. VBA code advice/Excel advice for summing groups of numbers
    By paulblower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2014, 05:47 AM
  4. [SOLVED] Macro to make copying cells automate,- an appeal for expert's advice!
    By Arty_1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-04-2014, 07:22 AM
  5. [SOLVED] Need advice on how to automate copying one cell into many cells in Excel 2010
    By shelbyjayIII in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2013, 05:48 PM
  6. [SOLVED] Multiple copying of a Spreadsheet advice please
    By Dermot in forum Excel General
    Replies: 3
    Last Post: 07-30-2006, 08:37 AM
  7. A little advice on comparing cells
    By systematic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-24-2005, 07:20 AM

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