How do I assign values to text in excel and then add them

One option is to use COUNTIF like this

=SUM(COUNTIF(A1:G1,{"A","B","C"})*{1,2,3})

You can vary {1,2,3} as required


To add values in A1:G1, use the following formula:

=SUMPRODUCT(MATCH(A1:G1,{"A","B","C"},0))

This generates an array of 7 numbers corresponding to the position in the array {"A","B","C"} that matches each letter and then sums the array of numbers.

For example, if A1:G1 hold A B B C B C A, this formula will generate the array {1,2,2,3,2,3,1} and then sum its contents.