I have the following Google Sheets table and want to calculate the total sums of various medications prescribed:
| A | B | C | |
|---|---|---|---|
| 1 | Type | Amount (in g) | Daily dosage (in g) |
| 2 | A | 60 | 2 |
| 3 | B | 25 mg/capsule | 30 pieces, 0-0-1 for 30 days |
| 4 | A | 10 | 0.5 |
This is very easy for medication type A, as I can just look in column B.
My issue is that the entries associated with medication type B don't only consist of digits, so I need to apply two REGEXTRACTs.
"[0-9]{2}""(\d+) pieces"That is all fine and would work.
But how do I get around the issue that the sum_range in SUMIFS needs to be digits?
Because something like this would not work afaik:
=ARRAYFORMULA(SUMIFS(REGEXEXTRACT(C2,"(\d+) pieces")...I cannot change the way this data is entered and also don't want to create additional columns if possible.