Here is the function -Error I get is = Last Statment within a function must return a statement.Can anyone help with this? Both my If/Else have a return did I miss something?CREATE FUNCTION Excel_HomesCount( @ProdDate DATETIME, @Market VARCHAR(20), @ZoneNo INT, @Year INT, @Rep INT, @MGR INT)RETURNS floatASBEGINIF @Rep > 0 RETURN ( SELECT Sum(tblhomesquote.Homes) AS SumOfHomes FROM (tblhomesquote INNER JOIN tblmailings ON tblhomesquote.ZoneNo = tblmailings.ZoneNo) INNER JOIN tblmailingperiods ON (tblhomesquote.SCID = tblmailingperiods.Market) AND (tblhomesquote.ProductionYear = tblmailingperiods.MPYear) AND (tblmailings.CalendarYear = tblmailingperiods.MPYear) WHERE (((tblhomesquote.SCID)=@Market) AND tblmailings.productiondate =@ProdDate and tblmailings.productiondate Between [tblmailingperiods].[startdate] And [tblmailingperiods].[enddate]) AND ((tblhomesquote.ZoneNo)=@ZoneNo) AND ((tblhomesquote.ProductionYear)=@Year) AND ((tblhomesquote.AssignedRep)=@rep) )ELSE RETURN ( SELECT Sum(tblhomesquote.Homes) AS SumOfHomes FROM (tblhomesquote INNER JOIN tblmailings ON tblhomesquote.ZoneNo = tblmailings.ZoneNo) INNER JOIN tblmailingperiods ON (tblhomesquote.SCID = tblmailingperiods.Market) AND (tblhomesquote.ProductionYear = tblmailingperiods.MPYear) AND (tblmailings.CalendarYear = tblmailingperiods.MPYear) WHERE (((tblhomesquote.SCID)=@Market) AND tblmailings.productiondate =@ProdDate and tblmailings.productiondate Between [tblmailingperiods].[startdate] And [tblmailingperiods].[enddate]) AND ((tblhomesquote.ZoneNo)=@ZoneNo) AND ((tblhomesquote.ProductionYear)=@Year) AND ((tblhomesquote.assignedmgr)=@MGR) )END