Excel Formula

as @Pseudo said power query is the best for this