+ Reply to Thread
Results 1 to 7 of 7

Moving data around based on Index formula results

  1. #1
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Moving data around based on Index formula results

    I have a range in cols A and B, A being cust id and B being order id. there are a varing number or order ids against the same customer id throughout the range

    In cols D through H i have data i need to bring these order ids next to, which I'm bringing into column I with the following formula:

    =INDEX($B$2:$B$8556, SMALL(IF($H$3241=$A$2:$A$8556, ROW($A$2:$A$8556)-MIN(ROW($A$2:$A$8556))+1, ""), ROW(A1)))

    when copied down it brings a range of order ids down through column I until it errors with a #NUM! result, i then manually move the dataset in columns D through H down to the row wher the first #NUM! error is within colimn I. edit the formula to represent the new reference in H and reset the counter to A1 and repeat.

    I'm trying to find a way to automate this to save me inserting cells and editing the formula aprox 7000 more times, any suggestions?

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,369

    Re: Moving data around based on Index formula results

    Try

    =IFERROR(INDEX($B$2:$B$8556, SMALL(IF($H$2=$A$2:$A$8556, ROW($A$2:$A$8556)-ROW($A$2)+1, ""), ROWS($A$1:A1))),"")

    Enter with Ctrl+Shift+Enter

  3. #3
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: Moving data around based on Index formula results

    Hi John

    That gives me returns where there are any to return and then blank cells instead of the #NUM! error.

    What I'm doing here is building a dataset based on the order ids returned. The data I intend to keep is in columns D to H, with new data (order ids) being brought into column I. The rows in columns D-H represent a customer line with the customer id in it, i want to bring, against each customer as many rows of order ids there are, into column I and then move the rows in columns D-H down to the first blank or #NUM! row and then repeat.

    it's the moving of the data in columns d-h to the first #NUM! row and rerunning the edited formula i'm trying to automate.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,369

    Re: Moving data around based on Index formula results

    Post a file to illustrate the problem.

  5. #5
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: Moving data around based on Index formula results

    try this,...
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,369

    Re: Moving data around based on Index formula results

    Sorry but the file doesn't explain to me what you require:

    What is starting position - before anything is place in I?

    Why do you want to repeat data in I?

    Why prefix order number with the text "Order no"?

    If you want the Order No in I to match those in A

    in I2

    =IF($H2<>$A1,B2,B1)

    copy down

  7. #7
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: Moving data around based on Index formula results

    the starting position is just columns d-h without blank rows, there are sometimes blank inn D and E or F,G and H but not both at the same time. This is essentially a customer list.

    The data I'm bringing into I, based on the range in A and B is the order numbers each of these customer rows (D-H) has, there are sometimes none but more often anywhere from one order number to over 100.

    So the manual version is to run the index formula from above in I, modifying the H column cell ref to the curent row, shift control and enter it and then copy it down, in say the instance of multiple returns in I i then highlight the cells (D-H) against the second result down to the last and insert cells to move the customer data down to the first availiable row (#NUL! in column I), therefore moving the customer data down so that the returned order numbers in column I are just against that cusomer row that returned them

    so the starting point is columns D-H with the order numbers stored in the aray A-B, the target being columns D-H, with I populated with corresponding order numbers and D-H being expanded so the rows are alligned forming the basis of a new dataset based on what is currently 2 unaligned sets

+ 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] moving data based on text, possible IF formula
    By tompixc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2015, 05:13 AM
  2. Replies: 0
    Last Post: 05-22-2014, 04:17 AM
  3. Replies: 6
    Last Post: 10-22-2013, 01:48 PM
  4. [SOLVED] Formula to display data validation results on another sheet based on data chosen?
    By myoung5149 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-16-2013, 02:53 PM
  5. NEED HELP - Columns data matching and moving results to another cell
    By monteiro1969 in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 09-07-2012, 10:11 AM
  6. Excel 2007 : Sorting Data Based On Formula Results
    By The_Snook in forum Excel General
    Replies: 3
    Last Post: 07-12-2011, 11:24 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