Help to reduce lengthy formula

malik641

Board Regular
Joined
Sep 6, 2005
Messages
65
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?

Thanks in advance[/b]
 

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
7,938
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"))
 

malik641

Board Regular
Joined
Sep 6, 2005
Messages
65
Thanks Oaktree :biggrin: 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 :LOL:
 

Forum statistics

Threads
1,078,532
Messages
5,341,016
Members
399,409
Latest member
Winfield Ullrich I

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top