The preposition just depends on the context:
There are ten companies bidding for the contract, of which only five have a good chance. = of these companies
I was in a situation in which it was hard to know what to do. = in this situation
The preposition is ruled not by the word 'which', but by other elements in the sentence.
Student or Learner