SOLVED

How to write a formula for a specific function

%3CLINGO-SUB%20id%3D%22lingo-sub-1553064%22%20slang%3D%22en-US%22%3EHow%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553064%22%20slang%3D%22en-US%22%3E%3CP%3EI%20think%20it%20is%20a%20simple%20formula%20but%20I%20just%20can't%20figure%20it%20out.%26nbsp%3B%20%26nbsp%3BI%20am%20adding%20two%20cells%20to%20a%20third%20cell.%26nbsp%3B%20How%20do%20I%20write%20the%20formula%20that%20if%20the%20number%20in%20the%202nd%20cell%20is%20zero%20-%20do%20not%20add%20until%20it%20is%20greater%20than%20zero.%26nbsp%3B%20Effectively%20leaving%20the%20third%20cell%20with%20zero%20until%20a%20number%20is%20added%20in%20the%202nd%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERight%20now%20it%20looks%20like%20this%3A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%2025%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B0%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20-25%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20it%20to%20say%3A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B25%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B0%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B0%26nbsp%3B%20%26nbsp%3B%20Until%20the%20number%20is%20added%20in%20the%202nd%20cell%20THEN%20preform%20the%20addition%20and%20show%20the%20results.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAm%20I%20describing%20it%20well%20enough%20to%20explain%20my%20request%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1553064%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553073%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553073%22%20slang%3D%22en-US%22%3E%3CP%3EActually%20-%20I%20am%20subtracting%20the%202nd%20cell%20from%20the%20first%20cell%20-%20hence%20the%20-25.%26nbsp%3B%20But%20I%20assume%20the%20formula%20is%20the%20same%20regardless.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553176%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553176%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F743594%22%20target%3D%22_blank%22%3E%40rgoins82%3C%2FA%3E%26nbsp%3BThat%20could%20be%20like%20in%20the%20picture%20below.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-07-29%20at%2016.00.51.png%22%20style%3D%22width%3A%20318px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F208805iB7BB88AAAB338065%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Screenshot%202020-07-29%20at%2016.00.51.png%22%20alt%3D%22Screenshot%202020-07-29%20at%2016.00.51.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553179%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553179%22%20slang%3D%22en-US%22%3ETry%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3DIF(B1%26gt%3B0%2CB1-A1%2C0)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553195%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553195%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F743594%22%20target%3D%22_blank%22%3E%40rgoins82%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DIF(COUNTIF(rangewithtwocells%2C%22%26gt%3B0%22)%3D2%2Ccalculation%2C0)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553788%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553788%22%20slang%3D%22en-US%22%3E%3CP%3EOk.%20I%20am%20getting%20and%20ERR504%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20exactly%20what%20I%20type%20for%20the%20formula%3A%26nbsp%3B%3DIF(COUNTIF(E55%2CE55%2C%22%26gt%3B0%22)%3D2%2CD55-E55%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20correct%20it%20for%20me%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553800%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553800%22%20slang%3D%22en-US%22%3E%3CP%3EI%20tried%20it%20this%20way%20as%20well%3A%26nbsp%3B%3DIF(COUNTIF(D55%2CE55%2C%22%26gt%3B0%22)%3D2%2CE55-D55%2C0)%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1553814%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20write%20a%20formula%20for%20a%20specific%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1553814%22%20slang%3D%22en-US%22%3EThanks%20to%20everyone!!%20It%20works%20and%20it%20was%20important%20for%20my%20spreadsheets!%20Thanks%20again!%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I think it is a simple formula but I just can't figure it out.   I am adding two cells to a third cell.  How do I write the formula that if the number in the 2nd cell is zero - do not add until it is greater than zero.  Effectively leaving the third cell with zero until a number is added in the 2nd cell.

 

Right now it looks like this:          25             0        -25

 

I want it to say:                             25             0           0    Until the number is added in the 2nd cell THEN preform the addition and show the results. 

 

Am I describing it well enough to explain my request? 

7 Replies
Highlighted

Actually - I am subtracting the 2nd cell from the first cell - hence the -25.  But I assume the formula is the same regardless.  

Highlighted

@rgoins82 That could be like in the picture below.

 

Screenshot 2020-07-29 at 16.00.51.png

Highlighted
Best Response confirmed by rgoins82 (Occasional Contributor)
Solution
Try:

=IF(B1>0,B1-A1,0)
Highlighted

@rgoins82 

=IF(COUNTIF(rangewithtwocells,">0")=2,calculation,0)
Highlighted

Ok. I am getting and ERR504

 

This is exactly what I type for the formula: =IF(COUNTIF(E55,E55,">0")=2,D55-E55,0)

 

Can you correct it for me?

 

Thank you so much!!

Highlighted

I tried it this way as well: =IF(COUNTIF(D55,E55,">0")=2,E55-D55,0) 

Highlighted
Thanks to everyone!! It works and it was important for my spreadsheets! Thanks again!