Within the internal ratings-based (IRB) approach of Basel II it is assumed that idiosyncratic risk has been fully diversified away. The impact of undiversified idiosyncratic risk on portfolio value-at-risk can be quantified using a granularity adjustment (GA). We provide an analytic formula for the GA in an extended single-factor CreditRiskC setting, incorporating double default effects. The formula accounts for guarantees and the reduction of credit risk in portfolios that is brought about by guarantees. Our general GA is very well suited for application under Pillar 2 of Basel II as the data inputs are drawn from quantities already required for the calculation of IRB capital charges.