Home

Complicated formula help

%3CLINGO-SUB%20id%3D%22lingo-sub-820190%22%20slang%3D%22en-US%22%3EComplicated%20formula%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820190%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20data%20table%20that%20looks%20something%20like%20this%2C%20only%20with%20significantly%20more%20rows.%20In%20this%20data%2C%20PR%2BTC%3DGL%20for%20each%20set%20of%20data%20in%20column%20A.%20So%2C%20for%20example%2C%26nbsp%3B%3C%2FP%3E%3CP%3E12345%20PR%20%2B%2012345%20TC%20%3D%2012345%20GL.%20In%20this%20case%20%2420%20%2B%20%2440%20%3D%20%2475%2C%20which%20is%20not%20correct.%20When%20it%20isn't%20correct%2C%20I%20need%20the%20difference%20to%20come%20from%20the%20number%20in%20the%20TC%20row%20--%20so%20in%20this%20example%2C%20the%20TC%20row%20would%20change%20from%20%2440%20to%20%2455.%20Is%20it%20possible%20to%20create%20a%20formula%20to%20do%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20border%3D%221%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3ECol%20A%3C%2FTD%3E%3CTD%3E%3CP%3ECol%20B%3C%2FP%3E%3C%2FTD%3E%3CTD%3ECol%20C%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12345%3C%2FTD%3E%3CTD%3E%3CP%3EPR%3C%2FP%3E%3C%2FTD%3E%3CTD%3E%2420%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12345%3C%2FTD%3E%3CTD%3ETC%3C%2FTD%3E%3CTD%3E%2440%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12345%3C%2FTD%3E%3CTD%3EGL%3C%2FTD%3E%3CTD%3E%2475%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E67890%3C%2FTD%3E%3CTD%3EPR%3C%2FTD%3E%3CTD%3E%2430%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E67890%3C%2FTD%3E%3CTD%3ETC%3C%2FTD%3E%3CTD%3E%2450%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E67890%3C%2FTD%3E%3CTD%3EGL%3C%2FTD%3E%3CTD%3E%2480%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-820190%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-820336%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20formula%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820336%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F397430%22%20target%3D%22_blank%22%3E%40kjpinch%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20check%20the%20formula%20and%20result%20in%20Column%20D%20in%20the%20attached%20file.%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20data%20has%20been%20formatted%20as%20an%20Excel%20table%2C%20this%20helps%20to%20copy%20down%20the%20formula.%3C%2FP%3E%3CP%3EThe%20formula%20also%20assumes%20that%20previous%20two%20consequetive%20rows%20have%20PR%20and%20TC%20values%20for%20a%20specific%20GL%20item.%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-820376%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20formula%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820376%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F397430%22%20target%3D%22_blank%22%3E%40kjpinch%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EAssuming%20%22GL%22%20is%20always%20directly%20under%20%22TC%22%20and%20your%20table%20begins%20in%20cell%20A1%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3DIF(B3%3D%22GL%22%2CC3-C2-C1%2C%22%22)%20could%20be%20a%20formula%20for%20cell%20D2%3C%2FP%3E%3CP%3E%3CEM%3EThen%20copy%20the%20formula%20down%20as%20necessary.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20would%20show%20the%20value%20in%20the%20TC%20row%20that%20is%20required%20to%20force%20PR%2BTC%3DGL.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-820461%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20formula%20help%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820461%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F397430%22%20target%3D%22_blank%22%3E%40kjpinch%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3E%3CP%3Eso%20in%20this%20example%2C%20the%20TC%20row%20would%20change%20from%20%2440%20to%20%2455.%20Is%20it%20possible%20to%20create%20a%20formula%20to%20do%20this%3F%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EA%20cell%20can%20either%20have%20a%20value%20or%20a%20formula%20but%20not%20the%20both.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3ETo%20change%20the%20TC%20price%20in%20the%20first%20place%2C%20you%20will%20need%20a%20VBA%20solution%20to%20achieve%20that.%3C%2FP%3E%3CP%3EAnd%20if%20you%20are%20open%20to%20a%20VBA%20solution%2C%20please%20upload%20a%20sample%20file%20with%20small%20subset%20of%20your%20data%20(after%20removing%20any%20sensitive%20data)%20and%20the%20layout%20of%20your%20sample%20file%20and%20your%20original%20file%20must%20be%20exactly%20the%20same.%3C%2FP%3E%3C%2FLINGO-BODY%3E
kjpinch
Occasional Visitor

I have a data table that looks something like this, only with significantly more rows. In this data, PR+TC=GL for each set of data in column A. So, for example, 

12345 PR + 12345 TC = 12345 GL. In this case $20 + $40 = $75, which is not correct. When it isn't correct, I need the difference to come from the number in the TC row -- so in this example, the TC row would change from $40 to $55. Is it possible to create a formula to do this?

 

Col A

Col B

Col C
12345

PR

$20
12345TC$40
12345GL$75
67890PR$30
67890TC$50
67890GL$80
3 Replies

@kjpinch 

Please check the formula and result in Column D in the attached file. 

Your data has been formatted as an Excel table, this helps to copy down the formula.

The formula also assumes that previous two consequetive rows have PR and TC values for a specific GL item.   

Hello @kjpinch,

 

Assuming "GL" is always directly under "TC" and your table begins in cell A1:

=IF(B3="GL",C3-C2-C1,"") could be a formula for cell D2

Then copy the formula down as necessary.

 

This would show the value in the TC row that is required to force PR+TC=GL.


@kjpinch wrote:

so in this example, the TC row would change from $40 to $55. Is it possible to create a formula to do this?


A cell can either have a value or a formula but not the both.

To change the TC price in the first place, you will need a VBA solution to achieve that.

And if you are open to a VBA solution, please upload a sample file with small subset of your data (after removing any sensitive data) and the layout of your sample file and your original file must be exactly the same.

Related Conversations