Before slavery, while Africans were still in their homeland, did they value formal education? If so, to what extent?
First, it has to be said that this question is a bit difficult to answer. The first problem is that Africa is a very large place that encompasses a good number of cultures. It is difficult to treat the continent as a homogeneous group. The second difficulty comes from the words "value" and "formal." What is our criteria for valuing something? How do we define a "formal" education? Lastly, "before slavery" is technically a period of thousands of years.
I am going to guess, because you're referring to slavery, that you're mostly interested in knowing more about the general educational practices in Africa during the period of around 1500 in the regions of West Africa most affected by the slave trade. This is an important distinction because places like Egypt and the rest of Muslim North Africa were culturally very different from the rest.
Again, the hard part here is the word "formal." If by "formal" you mean "European-style schoolhouses and colleges," then the Africans (in general) were not a part of such systems. Does this mean that they didn't value them, they didn't need them, or that they didn't have the means to create them? Maybe a little of all.
This doesn't mean that they didn't value education, just that their system of education was very different. It was "formal" in that it was structured, but it was "informal" in that process was not strictly uniform and didn't contain records and grades. What it did have, though, were tests. These were specific "rights of passage" that allowed young men and women to advance toward adulthood. Children who were unable to pass the "tests" continued to try. Prestige and honor came with advancement, while a certain amount of scorn was reserved for the lazy or incompetent. This also created a certain amount of "natural selection" that increased the strength of the community as a whole.
Education for boys and girls in Africa, before colonial days, was segregated by gender (generally.) As in many places across the world, the adults in the village taught the young people the skills they would need to survive. They also included instruction in the arts, dance, and ceremonial rituals that needed to be practiced as part of local religious beliefs. The children were taught both individually as well as in groups.
No culture, other than that found in New Jersey, can exist without a system of education to prepare the young. As a matter of survival that education has to be valued to at least some extent. Whether or not such a system of training, coupled with "rights of passage," constitutes a "formal" education depends on the meaning of the word.