+ Reply to Thread
Results 1 to 6 of 6

Inserting rows every time an account is different

  1. #1
    Registered User
    Join Date
    09-16-2019
    Location
    Philippines
    MS-Off Ver
    365
    Posts
    29

    Inserting rows every time an account is different

    I have balances from various companies in multiple columns.

    Goal is different parent accounts should be on different rows.

    Company A has 4 Sales accounts in C2:C5 while Company B has 6 Sales accounts in G2:G7.. then next account should start in row 8 for both companies.

    How should I insert rows per company where needed? Might be clearer in excel file which I attached.

    Thank you.
    Attached Files Attached Files
    Last edited by mia12; 11-06-2020 at 12:46 PM. Reason: solved

  2. #2
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Inserting rows every time an account is different

    How many companies do you have to do this for?

    The reason I ask, is that I did exactly what (I think) you wanted in about 5 seconds flat, using a simple cut and paste.

  3. #3
    Registered User
    Join Date
    09-16-2019
    Location
    Philippines
    MS-Off Ver
    365
    Posts
    29
    Quote Originally Posted by Croweater View Post
    How many companies do you have to do this for?

    The reason I ask, is that I did exactly what (I think) you wanted in about 5 seconds flat, using a simple cut and paste.
    Less than 10 companies but there would be more rows/accounts.

    Yeah, copying-pasting is easy enough but wanted to see if I could make a macro for it

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

    Re: Inserting rows every time an account is different

    Here is a formula base proposal illustrating how this might be accomplished.
    Put Sales, Advertising and Payroll into J2:J4
    Populate K2:M4 using: =COUNTIFS(INDEX($A$2:$G$11,,MATCH(K$1,$A$1:$G$1,0)),"*"&$J2&"*")
    Populate N2:N4 using: =SUM(MAX(K2:M2),1)
    Populate P2:P21 using: =IFERROR(INDEX(J$2:J$4,AGGREGATE(15,6,(ROW(J$2:J$4)-ROW(J$1))/(N$2:N$4>=ROWS(A$1:A1)),1)),"")
    Populate the Company columns using: =IF($P2="","",IFERROR(INDEX(A$2:A$11,AGGREGATE(15,6,(ROW(A$2:A$11)-ROW(A$1))/(ISNUMBER(SEARCH($P2,A$2:A$11))),COUNTIFS($P$2:$P2,$P2))),""))
    Populate the Amount columns using: =IF(Q2="","",INDEX(B$2:B$11,MATCH(Q2,A$2:A$11,0)))
    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.

  5. #5
    Registered User
    Join Date
    09-16-2019
    Location
    Philippines
    MS-Off Ver
    365
    Posts
    29

    Re: Inserting rows every time an account is different

    thank youuuu for this!

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

    Re: Inserting rows every time an account is different

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. Account for passage of time in QTD and YTD change calculations
    By maverick3957 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2019, 01:57 PM
  2. [SOLVED] Subtotal of time, should not taking into account the date
    By excelnabb in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-22-2018, 11:32 AM
  3. Find Min Time taking 24hrs into account
    By kiktuo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-24-2014, 09:06 PM
  4. Replies: 0
    Last Post: 05-20-2014, 11:58 AM
  5. Copying and inserting rows at the same time
    By MattHH in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2013, 09:07 AM
  6. Inserting rows for Missing Date/ Time data (Excel 2007)
    By mzalikhan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2011, 08:57 PM
  7. Improve response time for inserting rows in several hundred sections
    By LAF in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-05-2009, 03:58 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