{\sl Marginal problem} consists in finding a {\sl joint distribution} whose {\sl marginals} are equal to the given less-dimensional distributions. Let's generalize the problem so that there are given not only less-dimensional distributions but also {\sl conditional probabilities}. It is necessary to distinguish between objective (Kolmogorov) probability and subjective (de Finetti) approach. In the latter, the {\sl coherence problem} incorporates both probabilities and conditional probabilities in a unified framework. Different algorithms available for its solution are described e. g. in [A. Gilio and S. Ingrassia: Geometrical aspects in checking coherence of probability assessments. In: IPMU'96: Proceedings of the 6th International IPMU Conference (B. Bouchon-Meunier, M. Delgado, J. L. Verdegay, M. A. Vila, R. Yager, eds.), Granada 1996, pp. 55-59 and G. Coletti and R. Scozzafava: Characterization of coherent conditional probabilities as a tool for their assessment and extension. Internat. J. Uncertainty, Fuzziness and Knowledge-Based Systems, 4 (1996), 2, 103-127.]. In the context of the former approach, it will be shown that it is possible to split the task into solving the marginal problem independently and to subsequent solving pure "conditional" problem as certain type of optimization. First, an algorithm ({\sl Conditional problem}) that generates a distribution whose conditional probabilities are equal to the given ones is presented. Due to the multimodality of the criterion function, the algorithm is only heuristical. Due to the computational complexity, it is efficient for small size problems e. g. 5 dichotomical variables. Second, a method is mentioned how to unite {\sl marginal} and {\sl conditional} problem to a more general {\sl consistency} problem for objective probability. Due to computational complexity, both algorithms are effective only for limited number of variables and conditionals. The described approach makes possible to integrate in the solution of the consistency problem additional knowledge contained e. g. in an empirical distribution.