Forum Discussion
joanauhc
Jul 24, 2024Copper Contributor
Compare 2 columns and sum the larger value in column
Hello, I need help again. This is my formula: =SUM(IF('01-24 DB'!$AK19:$AK156>'01-24 DB'!$AN19:$AN156,'01-24 DB'!$AK19,$AN20)) I would like to compare column AK and AN, and if AK is > AN then i w...
HansVogelaar
MVP
If you have Microsoft 365:
=SUM(BYROW('01-24 DB'!$AK19:$AN156, LAMBDA(r, MAX(INDEX(r, 1), INDEX(r, COLUMNS(r))))))
joanauhc
Jul 24, 2024Copper Contributor
sorry, i think i explained it wrongly!
I would like to compare column AK and AN, and if AK is > AN then i will sum the value. If no, i wouldn't. So essentially, it should only sum up the values IF AK > AN.
Thank you so much!!
I would like to compare column AK and AN, and if AK is > AN then i will sum the value. If no, i wouldn't. So essentially, it should only sum up the values IF AK > AN.
Thank you so much!!
- HansVogelaarJul 24, 2024MVP
If you want to sum those values in AK that are larger than the corresponding value in AN:
=SUM('01-24 DB'!$AK19:$AK156*('01-24 DB'!$AK19:$AK156>'01-24 DB'!$AN19:$AN156))
or
=SUM(IF('01-24 DB'!$AK19:$AK156>'01-24 DB'!$AN19:$AN156, '01-24 DB'!$AK19:$AK156))