if condition

uswyne

Board Regular
Joined
Jul 27, 2017
Messages
78
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2010
Platform
  1. Windows
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Fee Structure[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Admission[/TD]
[TD]Security[/TD]
[TD]Tution Fee[/TD]
[TD]C.Fee[/TD]
[/TR]
[TR]
[TD]25000[/TD]
[TD]25000[/TD]
[TD]10000[/TD]
[TD]1000[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A1[/TD]
[TD]B1[/TD]
[TD]C1[/TD]
[TD]D1[/TD]
[TD]E1[/TD]
[TD]F1[/TD]
[TD]G1[/TD]
[/TR]
[TR]
[TD]Admission[/TD]
[TD]Security[/TD]
[TD]Month 1[/TD]
[TD]Month 2[/TD]
[TD]Tution Fee[/TD]
[TD]C.Fee[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]25000[/TD]
[TD]25000[/TD]
[TD]Aug-17[/TD]
[TD]Sep-17[/TD]
[TD]20000[/TD]
[TD]2000[/TD]
[TD]72000[/TD]
[/TR]
[TR]
[TD]25000[/TD]
[TD]25000[/TD]
[TD]Aug-17[/TD]
[TD][/TD]
[TD]10000[/TD]
[TD]1000[/TD]
[TD]61000[/TD]
[/TR]
[TR]
[TD]manually enter[/TD]
[TD]manually enter[/TD]
[TD]manually enter[/TD]
[TD]manually enter[/TD]
[TD]Formula[/TD]
[TD]Formula[/TD]
[TD]formula[/TD]
[/TR]
</tbody>[/TABLE]

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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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