=IF( and calculations within the same function

thirdeye85

New Member
Joined
Aug 11, 2021
Messages
28
Office Version
  1. 2019
Platform
  1. MacOS
I have a question about nesting calculations within the same =IF( function. For instance, I10 has a nested (IF function as follows: =IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))

This basically says that if the cell $E10=I$1 then G10 will be a positive number and if $F10=I$1 then it will be a negative. This functions well in its own right. However, I would like to attach the following calculation to this function (J14 within spreadsheet) =$G10-($G10*0.026)-0.1. This should only be calculated if B10 = CC, otherwise the calculation should not be performed and only the first two IF logical tests should apply.

I think all I need to do is add a third logical test that states that EVEN IF the first two are true, the last test given that B10=CC will supersede the previous arguments.

Am I going at this the right way?

And just some context the formula is a calculation of credit card fees that are tacked onto a dollar amount of $80.00; if CC is not input under type (B10) but rather CASH then the formula would not be required to calculate those fees.

Thank you for your help!

Double Entry Bookkeeping Final.xlsx
ABCDEFGHIJ
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
2
3
4
5
6
7
8
9
10Doe, JoeCC89/17/21SouthstateIncome$ 80.00$ 80.00-$80.00$80.00
11Doe, JaneCASH89/17/21SouthstateIncome$ 80.00$ 80.00-$80.00$80.00
12
13
14$ 77.82
Sheet2
Cell Formulas
RangeFormula
I10:J11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
C10:C11C10=MONTH(Ledger3[@Date])
J14J14=$G10-($G10*0.026)-0.1
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try this:
Book1
ABCDEFGHIJKLM
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
2
3
4
5
6
7
8
9
10Doe, JoeCC=MONTH(Ledger3[@Date])9/17/21SouthstateIncome8080-808077.72
11Doe, JaneCASH=MONTH(Ledger3[@Date])9/17/21SouthstateIncome8080-808080
12
13
1477.82
15
DataSheet1
Cell Formulas
RangeFormula
I10:J11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
L10:L11L10=(IF($E10=J$1,$G10,IF($F10=J$1,-$H10,0)))*(IF(B10="CC",0.984,1))-IF(B10="CC",1,0)
J14J14=$G10-($G10*0.026)-0.1
 
Upvote 0
Hi Thirdeye85,

Is this what you wanted?

Thirdeye85.xlsx
ABCDEFGHIJ
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
20
30
40
50
60
70
80
90
10Doe, JoeCC99/17/2021SouthstateIncome8080-8077.82
11Doe, JaneCASH99/17/2021SouthstateIncome8080-8080
Sheet1
Cell Formulas
RangeFormula
J2:J11J2=IF([@Type]="CC",$G2-($G2*0.026)-0.1,IF($E2=J$1,$G2,IF($F2=J$1,-$H2,0)))
I10:I11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
C10:C11C10=MONTH([@Date])
 
Upvote 0
Another option
Excel Formula:
=IF(B10="CC",$G10-($G10*0.026)-0.1,I10)
 
Upvote 0
Hi Thirdeye85,

Is this what you wanted?

Thirdeye85.xlsx
ABCDEFGHIJ
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
20
30
40
50
60
70
80
90
10Doe, JoeCC99/17/2021SouthstateIncome8080-8077.82
11Doe, JaneCASH99/17/2021SouthstateIncome8080-8080
Sheet1
Cell Formulas
RangeFormula
J2:J11J2=IF([@Type]="CC",$G2-($G2*0.026)-0.1,IF($E2=J$1,$G2,IF($F2=J$1,-$H2,0)))
I10:I11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
C10:C11C10=MONTH([@Date])
I tried your formula and it says that "The Syntax of this name isn't correct". Is the @Type a placement for something I should input?
 
Upvote 0
Another option
Excel Formula:
=IF(B10="CC",$G10-($G10*0.026)-0.1,I10)
Unfortunately, this did not keep the continuity of the other formula, =IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0)). Thank you for the reply.
 
Upvote 0
Try this:
Book1
ABCDEFGHIJKLM
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
2
3
4
5
6
7
8
9
10Doe, JoeCC=MONTH(Ledger3[@Date])9/17/21SouthstateIncome8080-808077.72
11Doe, JaneCASH=MONTH(Ledger3[@Date])9/17/21SouthstateIncome8080-808080
12
13
1477.82
15
DataSheet1
Cell Formulas
RangeFormula
I10:J11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
L10:L11L10=(IF($E10=J$1,$G10,IF($F10=J$1,-$H10,0)))*(IF(B10="CC",0.984,1))-IF(B10="CC",1,0)
J14J14=$G10-($G10*0.026)-0.1
Not quite sure I understand the "(IF(B10="CC",0.984,1))-IF(B10="CC",1,0)". Thank you for the reply.
 
Upvote 0
Try:
Excel Formula:
=IF($B10="CC",$G10-($G10*0.026)-0.1,IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0)))
 
Upvote 0
I tried your formula and it says that "The Syntax of this name isn't correct". Is the @Type a placement for something I should input?
I saw you had column D called Date so I assumed you had column B called Type. Here it is with cell address instead.

Thirdeye85.xlsx
ABCDEFGHIJ
1NotesTypeMonthDateAccount DebitedAccount Credited Debit Credit IncomeSouthState
20
30
40
50
60
70
80
90
10Doe, JoeCC99/17/2021SouthstateIncome8080-8077.82
11Doe, JaneCASH99/17/2021SouthstateIncome8080-8080
Sheet1
Cell Formulas
RangeFormula
J2:J11J2=IF(B2="CC",$G2-($G2*0.026)-0.1,IF($E2=J$1,$G2,IF($F2=J$1,-$H2,0)))
I10:I11I10=IF($E10=I$1,$G10,IF($F10=I$1,-$H10,0))
C10:C11C10=MONTH([@Date])
 
Upvote 0
Thanks guys we are getting closer however still no cigar, but I think I know what the problem is.

What I need the formula to do is to incorporate the logic of the later half of this equation into the first part, so that if CC is triggered in the B column it is following the logic of the 2nd half of the equation which converts column I or J (in your example Toadstool) into a positive or negative number. There is always going to be a positive or negative number since the transaction needs to be balanced. Currently if the first logical test is true it does not incorporate the second half of the logic in the equation and if CC is triggered this will only result in a positive number, which is an incorrect result.

It would need to look something like this:

If CC is not triggered in column B. If (E10=I1 then positive number in G10), If (F10 = I1 then negative number in H10). This is currently working by itself.

If CC is triggered in column B then. G10 - ($G10*0.026)-0.1, If (E10=I1 then positive number in G10, if (F10 = I1 then negative number in H10). This is not working as when the formula scans the logic it just reverts to the first part of the formula G10 - ($G10*0.026)-0.1. The more that I think about it we are not instructing the formula in "G10 - ($G10*0.026)-0.1" to change anything to a negative number in the H10 column if CC is trigged and this is what I want it to do if F10 = I1.

Would adding H10 - ($H10*0.026)-0.1 to somewhere in the formula make this work?
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top