In this randomized clinical trial of weight loss in obesity and type 2 diabetes, we found that the effect of weight loss on the brain in women with obesity and type 2 diabetes differed by menopausal status and APOE status. Women with obesity and cardiovascular risk factors who lost around 10% of their weight 10 years after menopause had worse cognitive performance compared to matched controls. In contrast, when women lost weight before or early after menopause, their cognitive functions were better than their matched controls. These benefits were only seen in APOE4 non-carriers. Our study underscores the importance of timing and APOE genotype. As our blood vessels and brain cells age, losing weight may deprive our body of essential nutrients. Weight loss in older APOE4 carriers may not be a good idea.