SOLVED

Can anyone sense check my formula? Copying cells between sheets

%3CLINGO-SUB%20id%3D%22lingo-sub-1886377%22%20slang%3D%22en-US%22%3ECan%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1886377%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20got%20this%20formula%20to%20copy%20cell%20contents%20into%20another%20sheet%20on%20the%20same%20workbook%3A%3CBR%20%2F%3E%3DIFERROR(INDEX('Sheet1'!%24D%3A%24D%2C%20TEXT(IF('Sheet1'!%24C%3A%24C%3D%22Yes%22%2CROW('Sheet1'!%24C%3B%24C))%2CROW()))%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I'm%20only%20about%2075%25%20content%20I%20actually%20know%20what%20the%20arguments%20are%20doing%20here%20(I%20threw%20in%20TEXT%20at%20a%20guess%20and%20it%20(kinda)%20worked).%3C%2FP%3E%3CP%3EThe%20idea%20is%20to%20select%20a%20number%20of%20different%20cells%20from%20a%20large%20list%20of%20items%20and%20copy%20the%20required%20data%20into%20a%20specific%20range%20on%20the%20new%20sheet.%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20I'm%20having%20is%20that%2C%20while%20I%20can%20get%20the%20relevant%20cell%20to%20copy%20to%20the%20new%20sheet%20when%20I've%20selected%20%22YES%22%20in%20the%20related%20cell%20(drop%20down%20list)%20the%20thing%20only%20seems%20to%20work%20in%20the%20same%20row%20across%20both%20sheets.%3CBR%20%2F%3EE.g.%20I'f%20I've%20selected%20Yes%20in%2C%20say%20C19%2C%20then%20the%20required%20data%20copies%20to%20the%20new%20sheet%20but%20only%20in%20the%20relevant%20cell%20in%20row%2019.%20If%20I%20hit%20Yes%20in%20row%2019%20and%2022%20then%2C%20again%2C%20data%20copies%20fine%20but%20only%20in%20those%20rows%20so%20there%20is%20a%202%20row%20gap%20between%20the%20data.%26nbsp%3B%3CBR%20%2F%3EFor%20clarity%20the%20range%20I%20wish%20to%20copy%20the%20relevant%20data%20to%20is%20the%20OrderForm%20table%20on%20the%20Order%20Form%20sheet.%3CBR%20%2F%3EAny%20help%20here%20is%20much%20appreciated.%26nbsp%3B%3CBR%20%2F%3ECheers%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EMalc%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1886377%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1887065%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887065%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20gathered%20that%20the%20red%20text%20section%20in%20the%20formula%20is%20the%20problem%20(least%20I%20think%20it%20is)%3CBR%20%2F%3E%3CSPAN%3E%3DIFERROR(INDEX('Sheet1'!%24D%3A%24D%2C%20TEXT(IF('Sheet1'!%24C%3A%24C%3D%22Yes%22%2C%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3EROW('Sheet1'!%24C%3B%24C))%3C%2FSTRONG%3E%3C%2FFONT%3E%2CROW()))%2C%22%22)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I'm%20drawing%20a%20big%20blank%20on%20how%20to%20fix%20it.%26nbsp%3B%3C%2FP%3E%3CP%3EOf%20course%2C%20the%20whole%20formula%20could%20be%20nonsense%20but%20it%20pulls%20the%20data%20I%20want%20across...just%20can't%20get%20it%20to%20set%20up%20as%20a%20continuous%20list.%3CBR%20%2F%3EImage%20attached%20to%20show%20the%20situation%20instead%20of%20re-attaching%20same%20workbook%20with%20options%20selected.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F233575iA2A4A1CCE7ADBC50%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%2212.png%22%20alt%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EMalc%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1887068%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887068%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F684222%22%20target%3D%22_blank%22%3E%40iapetustitan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMalc%2C%20could%20you%20please%20be%20more%20close%20to%20your%20sample%20file%20-%20there%20is%20Sheet1%20in%20it%20and%20there%20is%20the%20formula%20you%20try%20to%20use%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1887069%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887069%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%2C%20I%20put%20that%20rather%20than%20the%20actual%20sheet%20name%20as%20I%20thought%20it%20would%20be%20helpful.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIn%20the%20previously%20attached%20spreadsheet%20the%20formulas%20are%20housed%20in%20cell%20range%20C19%3AF38%20(in%20the%20'Order_Form'%20table%20in%20the%20%3CSTRONG%3EOrder%20Form%3C%2FSTRONG%3E%20%3CSTRONG%3Esheet%3C%2FSTRONG%3E)%20and%20are%20written%20fully%20as%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%3E%3DIFERROR(INDEX('East%20Stock%20Holdings'!%24D%3A%24D%2C%20TEXT(IF('East%20Stock%20Holdings'!%24C%3A%24C%3D%22Yes%22%2C%3C%2FSPAN%3E%3CFONT%20color%3D%22%23000000%22%3EROW('East%20Stock%20Holdings'!%24C%3B%24C))%3C%2FFONT%3E%3CSPAN%3E%2CROW()))%2C%22%22)%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ethe%20'INDEX'%20part%20of%20the%20formulas%20changes%20slightly%26nbsp%3Bdepending%26nbsp%3Bon%20the%20column%20they%20are%20in%20(the%20ranges%20used%20are%20%24D%3A%24D%20(as%20above)%2C%20%24E%3A%24E%2C%20%24G%3A%24G%20and%20%24H%3A%24H).%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20that%20more%20helpful%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888185%22%20slang%3D%22en-US%22%3ERE%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888185%22%20slang%3D%22en-US%22%3EHey%20folks%2C%20just%20bumping%20to%20keep%20this%20alive%2C%20hoping%20there%20is%20an%20answer%20out%20there.%20Thanks%20Malc%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888895%22%20slang%3D%22en-US%22%3ERE%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888895%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F684222%22%20target%3D%22_blank%22%3E%40iapetustitan%3C%2FA%3E%26nbsp%3BThanks%20for%20the%20clarification.%20Not%20sure%20I%20fully%20understood%20the%20logic%2C%20but%20I'd%20suggest%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F233658i521BD670AF024B35%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ein%20second%20column%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFERROR(%0A%20%20%20%20%20INDEX(%0A%20%20%20%20%20%20%20Area_Running_Totals%5BOrder%20Code%5D%2C%0A%20%20%20%20%20%20%20AGGREGATE(15%2C6%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%201%2F(Area_Running_Totals%5B%5BAdd%20To%20Order%3F%5D%3A%5BAdd%20To%20Order%3F%5D%5D%3D%22Yes%22)*%0A%20%20%20%20%20%20%20%20%20%20%20%20%20(ROW(Area_Running_Totals%5BAdd%20To%20Order%3F%5D)-ROW(Area_Running_Totals%5B%5B%23Headers%5D%2C%5BAdd%20To%20Order%3F%5D%5D))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20(ROW()-ROW(OrderForm%5B%5B%23Headers%5D%2C%5BSupplier%20Product%20Code%5D%5D))%0A%20%20%20%20%20%20%20)%0A)%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eand%20similar%20to%20the%20right.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1890301%22%20slang%3D%22en-US%22%3ERE%3A%20Can%20anyone%20sense%20check%20my%20formula%3F%20Copying%20cells%20between%20sheets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1890301%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExcellent%2C%20thanks%20so%20much.%20Works%20like%20a%20charm.%3C%2FP%3E%3CP%3EI'm%20scrutinising%20the%20formula%20to%20get%20a%20better%20understanding%20of%20it%2C%20still%20not%20sure%20how%20the%20'SMALL'%20function%20works%20with%20text%20but%20I%20also%20didn't%20know%20you%20could%20use%20normal%20operators%20(-%2C%20*%2C%20etc)%20with%20non-numeric%20data%20either%20(though%20I%20guess%20it's%20not%20technically%20the%20actual%20cell%20content%20that%20is%20super%20important%20in%20this%20fashion%3F).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20though%2C%20very%20much%20appreciated.%3C%2FP%3E%3CP%3EMalc%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi. 

I've got this formula to copy cell contents into another sheet on the same workbook:
=IFERROR(INDEX('Sheet1'!$D:$D, TEXT(IF('Sheet1'!$C:$C="Yes",ROW('Sheet1'!$C;$C)),ROW())),"")

 

Now I'm only about 75% content I actually know what the arguments are doing here (I threw in TEXT at a guess and it (kinda) worked).

The idea is to select a number of different cells from a large list of items and copy the required data into a specific range on the new sheet. 

The issue I'm having is that, while I can get the relevant cell to copy to the new sheet when I've selected "YES" in the related cell (drop down list) the thing only seems to work in the same row across both sheets.
E.g. I'f I've selected Yes in, say C19, then the required data copies to the new sheet but only in the relevant cell in row 19. If I hit Yes in row 19 and 22 then, again, data copies fine but only in those rows so there is a 2 row gap between the data. 
For clarity the range I wish to copy the relevant data to is the OrderForm table on the Order Form sheet.
Any help here is much appreciated. 
Cheers

Malc

10 Replies

I've gathered that the red text section in the formula is the problem (least I think it is)
=IFERROR(INDEX('Sheet1'!$D:$D, TEXT(IF('Sheet1'!$C:$C="Yes",ROW('Sheet1'!$C;$C)),ROW())),"")

 

But I'm drawing a big blank on how to fix it. 

Of course, the whole formula could be nonsense but it pulls the data I want across...just can't get it to set up as a continuous list.
Image attached to show the situation instead of re-attaching same workbook with options selected. (didn't mention before but the formula is applied across all the cells in the order_form table with edits in the ranges to match whats needed in each column).

12.png

 

Thanks

Malc

@iapetustitan 

Malc, could you please be more close to your sample file - there is Sheet1 in it and there is the formula you try to use?

@Sergei Baklan 

Sorry, I put that rather than the actual sheet name as I thought it would be helpful.


In the previously attached spreadsheet the formulas are housed in cell range C19:F38 (in the 'Order_Form' table in the Order Form sheet) and are written fully as:


=IFERROR(INDEX('East Stock Holdings'!$D:$D, TEXT(IF('East Stock Holdings'!$C:$C="Yes",ROW('East Stock Holdings'!$C;$C)),ROW())),"") 

 

the 'INDEX' part of the formulas changes slightly depending on the column they are in (the ranges used are $D:$D (as above), $E:$E, $G:$G and $H:$H).

Is that more helpful?

Hey folks, just bumping to keep this alive, hoping there is an answer out there. Thanks Malc
best response confirmed by iapetustitan (Occasional Contributor)
Solution

@iapetustitan Thanks for the clarification. Not sure I fully understood the logic, but I'd suggest

image.png

in second column

=IFERROR(
     INDEX(
       Area_Running_Totals[Order Code],
       AGGREGATE(15,6,
             1/(Area_Running_Totals[[Add To Order?]:[Add To Order?]]="Yes")*
             (ROW(Area_Running_Totals[Add To Order?])-ROW(Area_Running_Totals[[#Headers],[Add To Order?]])),
             (ROW()-ROW(OrderForm[[#Headers],[Supplier Product Code]]))
       )
),"")

and similar to the right.

@Sergei Baklan 

Excellent, thanks so much. Works like a charm.

I'm scrutinising the formula to get a better understanding of it, still not sure how the 'SMALL' function works with text but I also didn't know you could use normal operators (-, *, etc) with non-numeric data either (though I guess it's not technically the actual cell content that is super important in this fashion?).

 

Thanks again though, very much appreciated.

Malc

@iapetustitan 

SMALL actually means that we take 1st, 2nd, 3rd, etc. value for which [Add to Order] flag is "Yes". For example

row flag value

1               201      

2       Yes   302

3               103

4       Yes     55

5               105

 

first smallest position with flag will be 2; second smallest position is 4, etc. Returned values are 302 and 55 accordingly.

 

Didn't catch the question about arithmetic operations with texts - nope, as a rule that doesn't work, by why do you need them here?

5

@Sergei Baklan 

I meant in ref to the operators in the formula you supplied:
"...="Yes")*(ROW..." and "..(ROW()-ROW..."

Wouldn't have thought they would be used in a non-numeric sense. I'm learning though.

 

I see what you mean re the 'SMALL' function. That's a bit easier to understand than the examples I'd read online. Thanks.

 

Malc

@iapetustitan 

"...="Yes")  returns TRUE of FALSE which is equivalent of 1 or 0

ROW(Table[Column]) returns array of row numbers for the column (5,6,7,8,...)

ROW() returns row number (5,11,15, whatever)

 

I don't see here texts at all

 

I was meaning non-numeric in reference to the cell content.
That was my misunderstanding.
My only experience of using */+/-, etc. was with the SUM functions and numeric data in the cells.
I'm not looking to use it here was just commenting that I didn't now they could be used at all as my mind was on the cell content.