Date Formula

fairchance

Board Regular
Joined
Jan 4, 2015
Messages
110
Dear Sir,

I am seeking data formula/function that could calculate the number of days from the expected date to actual date.
I can come up with formula to calculate the number of dates between real dates and expected dates. Here is the example parameters:

Range Definition:(days of month)
Beg 1-10
mid 11-20
End 21-30

<tbody>
</tbody>
Expacted date for submission Actual Date Formula
21-Dec-1421-Dec-140
21-Dec-1418-Dec-14-3
21-Dec-1427-Dec-146
Beg Dec 149-Dec-14 #VALUE!
End Dec 1418-Dec-14 #VALUE!
Mid Dec 1427-Dec-14 #VALUE!

<tbody>
</tbody>
How can i calculate date difference in case of date relate to particular range? Any one can help please.

Regards

Shehbaz

<tbody>
</tbody>
 
Sir, I have tested and found same mistake
result is converted from value to -1 instead of 0 and -19 instead of 12
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Test (note -19 is correct as "beg" = 10 for calc purposes).

=IF(AND(LEFT(A2,3)="beg",DAY(B2)<=10),0,IF(AND(LEFT(A2,3)="mid",DAY(B2)>10,DAY(B2)<=20),0,IF(AND(LEFT(A2,3)="end",DAY(B2)>=20),0,IF(LEFT(A2,3)="beg",B2-(10&RIGHT(A2,7)),IF(LEFT(A2,3)="mid",B2-(20&RIGHT(A2,7)),IF(LEFT(A2,3)="end",B2-(31&RIGHT(A2,7)),B2-A2))))))
 
Upvote 0
Sir, Thank you so much many expert tried on excelguru forum but failed. I really appreciate your caliber and capabilities. Sir, another criteria may please be incorporte with this formula

=IF(NOT(ISBLANK(a2)),(b28-a2),"not applicable")

It is in a case of blank value of expected date

Kind Regards

Shehbaz H.
 
Upvote 0
Try
=IF(A2="","Not Applicable",IF(AND(LEFT(A2,3)="beg",DAY(B2)<=10),0,IF(AND(LEFT(A2,3)="mid",DAY(B2)>10,DAY(B2)<=20),0,IF(AND(LEFT(A2,3)="end",DAY(B2)>=20),0,IF(LEFT(A2,3)="beg",B2-(10&RIGHT(A2,7)),IF(LEFT(A2,3)="mid",B2-(20&RIGHT(A2,7)),IF(LEFT(A2,3)="end",B2-(31&RIGHT(A2,7)),B2-A2)))))))
 
Upvote 0
I really salute you sir. You are so nice and genius person in the world of "Excelologist" Do not worry it my self created term :)
By the way what is your name sir?
 
Upvote 0
Simply change the 1st A2 to B2
=IF(B2="","Not Applicable",IF(AND(LEFT(A2,3)="beg",DAY(B2)<=10),0,IF(AND(LEFT(A2,3)="mid",DAY(B2)>10,DAY(B2)<=20),0,IF(AND(LEFT(A2,3)="end",DAY(B2)>=20),0,IF(LEFT(A2,3)="beg",B2-(10&RIGHT(A2,7)),IF(LEFT(A2,3)="mid",B2-(20&RIGHT(A2,7)),IF(LEFT(A2,3)="end",B2-(31&RIGHT(A2,7)),B2-A2)))))))
 
Upvote 0
Lol took a while but near to what you wanted, there is probably a simpler way, but for now hopefully it's near enough.

Take a look at my post regarding the other calculation you wanted.

Regards
Gaz
 
Upvote 0
Do you mean this one?

Leads 1-55$10
Leads 6-1010$15
Leads 11+$20
March
12345
JohnQualified45566
SallyQualified631854
BenQualified76455
HarryQualified11134513
John$40$50$50$65$65
Sally$65$30$285$50$40
Ben$80$65$40$50$50
Harry$145$185$40$50$185
Create the small table in B1:C3
FORMULA in D15
=IF(C9<=$B$1,C9*$C$1,IF(AND(C9>$B$1,C9<=$B$2),((C9-$B$1)*$C$2)+($B$1*$C$1),IF(C9>$B$2,((C9-$B$2)*$C$3)+($B$1*$C$2)+($B$1*$C$1),"")))

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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