# Help to reduce lengthy formula

#### malik641

##### Board Regular
I need to place this formula into 120,000 cells. Problem is, the workbook becomes quite LARGE (around 25MB extra from THESE cells alone) if I copy and paste the following formula into 10,000 rows by 12 columns.

Here's the formula with an explanaition following:

=IF(OR(Forecast!G2="",Actual!G2=""),"",IF(ISERROR(OR(DATEDIF(Forecast!G2,Actual!G2,"Y"),DATEDIF(Forecast!G2,Actual!G2,"ym"),DATEDIF(Forecast!G2,Actual!G2,"md"))),"",IF(AND(DATEDIF(Forecast!G2,Actual!G2,"Y")=0,DATEDIF(Forecast!G2,Actual!G2,"ym")=0,DATEDIF(Forecast!G2,Actual!G2,"md")=0),"Projected: "&TEXT(Forecast!G2,"dd-mmm-yyyy")&CHAR(10)&"On Time","Projected: "&TEXT(Forecast!G2,"dd-mmm-yyyy")&CHAR(10)&DATEDIF(Forecast!G2,Actual!G2,"Y")&" Years "&DATEDIF(Forecast!G2,Actual!G2,"ym")&" Months "&IF(DATEDIF(Forecast!G2,Actual!G2,"md")<=0,"0 Days",DATEDIF(Forecast!G2,Actual!G2,"md")&" Days"))))

This formula calls on two sheets: Forecast and Actual

Forecast and Actual contain dates on when the user thinks something will happen (hence, forecast) and when that something ACTUALLY does happen (and of course, Actual).

If the date on Actual exceeds the date on Forecast, it is considered late. Here is some sample data and results for late and on time dates.

Late
Forecast:
G2= 5/25/2005

Actual:
G2= 5/26/2005

Result from formula:

Projected: 5/25/2005
0 Years 0 Months 1 Days

On Time
Forecast:
G2= 5/25/2005

Actual:
G2= 5/20/2005

Result from formula:

Projected: 5/25/2005
On Time

And if either date is missing, it returns a blank.
Maybe I should reconsider the style of the results?

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
A little better...

Code:
``=IF(OR(Forecast!G2="",Actual!G2=""),"","Projected: "&TEXT(Forecast!G2,"dd-mmm-yyyy")&CHAR(10)&IF(Forecast!G2<Actual!G2,DATEDIF(Forecast!G2,Actual!G2,"y")&" years "&DATEDIF(Forecast!G2,Actual!G2,"ym")&" months "&DATEDIF(Forecast!G2,Actual!G2,"md")&" days","On Time"))``

Thanks Oaktree Just what I needed.

And I just spoke to my boss and she said I won't need to use 10,000 rows....only about 500. So even better now

Replies
2
Views
224
Replies
1
Views
163
Replies
0
Views
648
Replies
4
Views
352
Replies
7
Views
204

1,217,758
Messages
6,138,439
Members
450,137
Latest member
HANHAN

### 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.

### Which adblocker are you using?

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

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