Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Google Sheets SUMIFS - apply REGEXTRACT to sum_range?

$
0
0

I have the following Google Sheets table and want to calculate the total sums of various medications prescribed:

ABC
1TypeAmount (in g)Daily dosage (in g)
2A602
3B25 mg/capsule30 pieces, 0-0-1 for 30 days
4A100.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.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>