View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stan Brown Stan Brown is offline
external usenet poster
 
Posts: 524
Default IF and IF and IF

On Fri, 10 Aug 2012 11:47:23 +0000, Ramona88 wrote:

@Claus Busch
I tried your formula but it doesn't give me the correct output. Thank
you anyway.


What's with the @ signs? Please quote correctly:
http://oakroadsystems.com/genl/unice.htm#quote

@Stan Brown
I tried this but don't really know how to connect those two IFs so it
obviously gives me an error:

=IF(D4<=$F$1-365,2.5,0)AND(IF(D4$F$1-730,5,2.5))

D4 - Start Date
F1 - Today's Date


(And from your previous article, which you should have quoted but
didn't):

Employees that have been with the company for less than 1 year -
return 0
Employees that have been with the company between 1 and 2 years -
return 3
Employees that have been with the company for 2+ years - return 5


Think about what IF does: if a condition is true, return A; otherwise
return B. If you want to test multiple conditions, you have in
effect an if-then-else-if situation.

=IF(A1=1, "one", IF(A1=2, "two", IF(A1=3, "three", "none of the
above) ) )

See the pattern?

In your case it's

=IF(F1-D4<365, 1, IF(F1-D4<2*365, 3, 5) )

We're both ignoring leap years, by the way.



--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...