I am trying to find a particular string in a specific range of cells and the sum of the values that are inside the brackets following that particular string and storing the same in another table.
For Example, In Sample Sheet
I am trying to find the string Food
in the range C3:C33
and add the values inside the brackets 200,100,150,55,150,120
in Table 1 and store their sum 775
in Table 2.
I wondered if this could be automated using a formula.
Table 1
A | B | C |
---|---|---|
Date | Day | Details |
01-01-2022 | Saturday | Food(200)+Parking(50) |
07-01-2022 | Friday | Food(100)+Shopping(500)+Travel(100) |
08-01-2022 | Saturday | Shopping(200) |
10-01-2022 | Monday | Food(150)+Travel(90+25) |
15-01-2022 | Saturday | Food(55)+Shopping(88)+Parking(73) |
18-01-2022 | Tuesday | Food(150) |
22-01-2022 | Saturday | Food(120)+Movies(300)+Parking(80) |
28-01-2022 | Friday | Parking(120) |
31-01-2022 | Monday | Movies(250) |
Table 2
G | H |
---|---|
Spending Area | Total |
Food |
775 |
Travel | 215 |
Movies | 550 |
Parking | 323 |
Shopping | 788 |
=SUM(ARRAYFORMULA(IFERROR(VALUE(REGEXEXTRACT(C3:C33,G3&"\((\d+)")),0)))
would do the job. But a string like "Travel(90+25)" spoils everything. Is it important for you to see just such an entry in brackets?