worksheet function – Excel: I need help accomplishing the following: If 2 conditions are met, sum up all the values entered in the history of a specific cell

I need help with the following:
I need a formula or a code in VBA Excel or both, that will do the following:

If the Cell B5 has a specific text/value AND if the cell B13 has a specific text/value,
Make the sum of all values entered in the cell H13 while the above conditions were met.

Let me clarify:
While the cells B5 and B13 will have specific text inside them, I will introduce in H13 a value.
Then I will print the excel sheet and I will change the information in Cells B5 and B13 and then replace the value in H13 with another one, or I can let the information in Cells B5 and B13 the same, but change the value of the H13. And repeat this again and again.

I need Excel to record all the values entered in H13 while the conditions 1 an 2 were met and to sum these values up in another cell.

If the cell B5 has the date 05.06.2021, and the Cell B13 has the code 12345, sum up the current value of H13 with the previous values of H13 (but only the previous values that were in H13 while the date was 05.06.2021 and the code was 12345.)
If the date or the code was different, add the current value of H13 to a different sum that takes into consideration what is in B5 and B13.

Basicaly, I want this sum to work different for each date and code.

Can somebody help me with this ? Thank you
If you need more details, I’m happy to give them to you