if condition

uswyne

Board Regular
Joined
Jul 27, 2017
Messages
78
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2010
Platform
  1. Windows
Fee Structure
AdmissionSecurityTution FeeC.Fee
2500025000100001000

<tbody>
</tbody>

A1B1C1D1E1F1G1
AdmissionSecurityMonth 1Month 2Tution FeeC.FeeTotal
2500025000Aug-17Sep-1720000200072000
2500025000Aug-1710000100061000
manually entermanually entermanually entermanually enterFormulaFormulaformula

<tbody>
</tbody>

I want if C1 and D1 are filled with month name than E1 and F1 charge for fee for 2 months (multiply by 2) and if one is filled C1 or D1 than 1 month fee charge.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Let say your C.free value is placed in K1 then:

F3=IF(AND(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1*2,IF(OR(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1,"0"))
Tihs formula will return "0" if there are no dates in C and D. If date data will exist in anyways then, you may delete ,"0" expression (with comma).
You can use the same formula in E3 for the Tution Fee.
 
Last edited by a moderator:
Upvote 0
If 2 is not a fixed multiplier and changes according to number of months then;


F3=IF(AND(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1*(MONTH(D3)-MONTH(C3))+1,IF(OR(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1,"0"))
 
Last edited by a moderator:
Upvote 0
thanks for your response.

the formula I have entered but too many arguments error occur.

Let say your C.free value is placed in K1 then:

F3=IF(AND(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1*2,IF(OR(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1,"0"))
Tihs formula will return "0" if there are no dates in C and D. If date data will exist in anyways then, you may delete ,"0" expression (with comma).
You can use the same formula in E3 for the Tution Fee.
 
Upvote 0
thanks for your response.

the formula I have entered but too many arguments error occur.
Ok tnen, try this one:

=IF(AND(ISNUMBER(C3),ISNUMBER(D3)),$K$1*2,IF(OR(ISNUMBER(C3),ISNUMBER(D3)),$K$1,"0"))

This works fine for me.
 
Upvote 0
Hi,

How about this, change cell references for Fee Structure Table as required:


Book1
ABCDEFGHIJKL
1AdmissionSecurityMonth 1Month 2Tution FeeC.FeeTotalFee Structure
2250002500017-Aug17-Sep20000200072000AdmissionSecurityTution FeeC.Fee
3250002500017-Aug100001000610002500025000100001000
425000250000050000
5250002500017-Aug17-Sep20000200072000
Sheet9
Cell Formulas
RangeFormula
E2=--COUNT(C2:D2)*K$3
F2=--COUNT(C2:D2)*L$3
G2=SUM(A2,B2,E2,F2)


E2, F2, G2 formulae copied down.
 
Upvote 0
this formula shows 0

If 2 is not a fixed multiplier and changes according to number of months then;


F3=IF(AND(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1*(MONTH(D3)-MONTH(C3))+1,IF(OR(ISNUMBER(DATEVALUE(C3)),ISNUMBER(DATEVALUE(D3))),$K$1,"0"))
 
Upvote 0
Hi,

Additional formulae for additional months, if duration might be more than 2 months, then use formulae in Row 6:


Book1
ABCDEFGHIJKL
1AdmissionSecurityMonth 1Month 2Tution FeeC.FeeTotalFee Structure
2250002500017-Aug17-Sep20000200072000AdmissionSecurityTution FeeC.Fee
3250002500017-Aug100001000610002500025000100001000
425000250000050000
5250002500017-Aug17-Sep20000200072000
6250002500017-Aug17-Dec40000400094000
7250002500017-Aug10000100061000
825000250000050000
Sheet9
Cell Formulas
RangeFormula
E2=--COUNT(C2:D2)*K$3
E6=IF(C6="",0,IF(COUNT(C6:D6)=2,(MONTH(D6)-MONTH(C6))*K$3,K$3))
F2=--COUNT(C2:D2)*L$3
F6=IF(C6="",0,IF(COUNT(C6:D6)=2,(MONTH(D6)-MONTH(C6))*L$3,L$3))
G2=SUM(A2,B2,E2,F2)
G6=SUM(A6,B6,E6,F6)
 
Last edited:
Upvote 0
Sorry for late reply.

this works me too.

thanks
Ok tnen, try this one:

=IF(AND(ISNUMBER(C3),ISNUMBER(D3)),$K$1*2,IF(OR(ISNUMBER(C3),ISNUMBER(D3)),$K$1,"0"))

This works fine for me.
 
Upvote 0

Forum statistics

Threads
1,215,947
Messages
6,127,867
Members
449,410
Latest member
adunn_23

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