#1   Report Post  
Posted to microsoft.public.excel.misc
Joy Joy is offline
external usenet poster
 
Posts: 29
Default If Statement

I have a series of data for projects with a project start date, a project end
date and a total amount for each project. I need to break the amount for
each project down into years by the no of days the project ran in each of the
years it ran (i.e. putting an amount under each year 2002, 2003, 2004). I am
assuming an if statement breaking the amount down to a cost per day would be
the way to go but am not sure how to go about getting data seperated for each
year.
Joy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 510
Default If Statement

Hi

Let's assume you data are on sheet Projects, and the table starts from
column A with headers in row1.
Project ; Start ; End ; Amount

Define a named range ProjectTable
ProjectTable=OFFSET(Projects!$A$1,1,,COUNTA(Projec ts!$A:$A)-1,4)

Add a sheet Summary, with a table on it:
Project ; 2002 ; 2003 ; 2004 etc

, and enter your project names/ID's into 1st column (or use links to sheet
Projects).

Select cell B2 on sheet Summary (NB! Be sure the cell is selected!) and
define named ranges
ProjStart=VLOOKUP(Summary!$A2,ProjectTbl,2,0)
ProjEnd=VLOOKUP(Summary!$A2,ProjectTbl,3,0)
ProjStartY=YEAR(ProjStart)
ProjEndY=YEAR(ProjEnd)
ProjAmount=VLOOKUP(Summary!$A2,ProjectTbl,4,0)

NB! Be sure relative/absolute references are exactly as in my example! Those
are dynamic named ranges, and active cell placement and reference types
affect directly how those ranges work later!

Into cell B2 on sheet Summary enter the formula
=IF(AND(ProjStartY<=B$1,ProjEndY=B$1),(DATEDIF(MA X(DATE(B$1,1,1),ProjStart),MIN(DATE(B$1+1,1,0),Pro jEnd),"D")+1)/(DATEDIF(ProjStart,ProjEnd,"D")+1)*ProjAmount,"")
, and copy the formula to whole summary table.
It's all.

Of-course you can add year columns directly to your original table. When you
do this, you have to alter definitons for names like Proj??? , and also
change year references in final formula.



Arvi Laanemets



"Joy" wrote in message
...
I have a series of data for projects with a project start date, a project
end
date and a total amount for each project. I need to break the amount for
each project down into years by the no of days the project ran in each of
the
years it ran (i.e. putting an amount under each year 2002, 2003, 2004). I
am
assuming an if statement breaking the amount down to a cost per day would
be
the way to go but am not sure how to go about getting data seperated for
each
year.
Joy



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Can an If statement answer an If statement? M.A.Tyler Excel Discussion (Misc queries) 2 June 24th 07 04:14 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"