Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel
|
|||
|
|||
Copying rows down into cells across until row=false ?
I see that you have a VBA solution from Roger, and that this works for
you. However, here is a modified formula solution. With your data in column A and your formula in column B, put this formula in C1: =IF(B1,100*COUNTIF(B$1:B1,TRUE),"") (similar to before, but multiplying by 100), and put this one in C2: =IF(B2,100*COUNTIF(B$1:B2,TRUE),C1+1) Copy the formula in C2 down as far as you need. This gives you a sequential count in each cell where the parents all have a numerical value in increments of 100, and the children have increments of 1 within each 100 (i.e. you can have up to 100 child records for each parent). You can now use this formula in D1: =IF(ISNA(MATCH(ROW(A1)*100,C:C,0)),"",INDEX(A:A,MA TCH(ROW(A1)*100,C:C, 0))) and copy this one down as far as you need, then put this formula in E1: =IF(ISNA(MATCH(ROW(A1)*100+COLUMN(A1),$C:$C,0)),"" ,INDEX($A: $A,MATCH(ROW(A1)*100+COLUMN(A1),$C:$C,0))) (simpler than before) and copy this across and down as far as you think you will need it. This is the result I got with your second set of data: SHEEP TRUE 100 SHEEP Dave Brian Paul Dave FALSE 101 COW Sue Helen Brian FALSE 102 CHICKEN Dave Roger George Paul FALSE 103 HORSE Raj Pritpal Sanjay COW TRUE 200 LIMUR Rik Bob Sue FALSE 201 Helen FALSE 202 CHICKEN TRUE 300 Dave FALSE 301 Roger FALSE 302 George FALSE 303 HORSE TRUE 400 Raj FALSE 401 Pritpal FALSE 402 Sanjay FALSE 403 LIMUR TRUE 500 Rik FALSE 501 Bob FALSE 502 (The formatting might not be exactly right). Hope this helps. Pete On Mar 27, 11:25*am, jonski wrote: "Pete_UK" wrote: *You will end up with something like this: COW * * * *TRUE * * 1 * *COW SHEEP * * TRUE * * 2 * *SHEEP * *Jim * * *Bob * * Stu Jim * * * * * FALSE * * * * RHINO * * Dave * *Ollie Bob * * * * *FALSE Stu * * * * * FALSE RHINO * * *TRUE * * 3 Dave * * * * FALSE Ollie * * * * *FALSE Then you can fix the values in D1 across and down and then concatenate your child cells. You can delete the first 3 columns. Looks good, but I'm getting some weirdness: For example (and I hope the formatting comes out OK!) SHEEP * TRUE * *1 * * * SHEEP * Dave * *Brian * Paul Dave * *FALSE * * * * * COW * * Sue * * * * * * Helen * Brian * FALSE * * * * * CHICKENDave * * * * * * Paul * * * * * *FALSE * * * * * HORSE * * * * * * * * * COW * * TRUE * *2 * * * LIMUR * Rik * * Bob * * Sue * * * * * * FALSE * * * * * * * * * * * * * * * * * Helen * FALSE * * * * * * * * * * * * * * * * * CHICKENTRUE * * 3 * * * * * * * * * * * * * * * Dave * *FALSE * * * * * * * * * * * * * * * * * Roger * FALSE * * * * * * * * * * * * * * * * * George *FALSE * * * * * * * * * * * * * * * * * HORSE * TRUE * *4 * * * * * * * * * * * * * * * Raj * * * * * * FALSE * * * * * * * * * * * * * * * * * Pritpal FALSE * * * * * * * * * * * * * * * * * Sanjay *FALSE * * * * * * * * * * * * * * * * * LIMUR * TRUE * *5 * * * * * * * * * * * * * * * Rik * * * * * * FALSE * * * * * * * * * * * * * * * * * Bob * * * * * * FALSE * * * * * * * * * * * * * * * * * So we're doing great until CHICKEN, where Roger and George get forgotten about, then Raj, Pritpal and Sanjay (I'm going for diversity here!) completely miss out on the HORSE, and we're back to normal for Rik and Bob's LIMUR experience. Also, in the bigger full version, there are lots of lines like (for example) SHEEP * TRUE * *1 * * * SHEEP * Dave * *Brian * Paul *COW * * * Rik * * Bob * * Am I allowed to paste links to the file? I know it seems a bit cheeky but if it helps...http://stashbox.org/v/836846/example...olumn_file.xls I really do appreciate the help so far. I couldn't get Ashish Mathur's other option to work, perhaps it's because I have Excel 2010 beta? But also, with over 2,000 rows, it appears I have to be doing something manually. Unless I understood it wrong, that still means the same amount of work? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying rows down into cells across until row=false ? | Excel Worksheet Functions | |||
Copying & Dragging Cells & Keeping Rows On all Screens | New Users to Excel | |||
Adding Rows and copying cells | New Users to Excel | |||
Need help copying cells into rows with spaces between | Excel Discussion (Misc queries) | |||
Copying cells from varying rows | Excel Discussion (Misc queries) |