'Is there any Excel function that can copy culumn's (first row's) name if the value matches?

I can't figure out a function that would automatically copy the first row value if the value on another rows matches 1. I would need the red dates to be automated. Any advice would be very appreciated, thank you!

Excel problem



Solution 1:[1]

=INDEX($E$1:$O$1;1;MATCH(1;E2:O2;0))

Replace semicolon with comma if your Excel version needs it.

enter image description here

If you have, you can also use Xlookup, it's a bit easier.

=XLOOKUP(1;E2:O2;$E$1:$O$1;"not found")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1