Then you can forget about a reasonable query. SQL works row-oriented, not column-oriented.
But with VBA and the appropriate skills you can solve everything, even if it is more complicated and time-consuming.
With such an Excel-typical structure, you can also switch to Excel for processing. But...