Hunter Lindsey
Hunter Lindsey

Reputation: 59

How do I use a REGEXMATCH, SUM, and ARRAYFORMULA in a code

Some magic items grant extra bonuses therefore extra numbers, these 18 checks can't all fit in a grid and look nice. I put a data validation on the 18 checks and I have a grid of magic items that provide different bonuses. So what you do is you label the type of check then label the bonus. I'm using a REGEXMATCH, SUM, and an IF statement. The following code is just for 1 check.

=ARRAYFORMULA(IF(REGEXMATCH(C3:C18,J2),SUM(REGEXMATCH(C3:C18,J2)),))

I need a code where If C3 = J2 then add D3 but I need that to be throughout C3:D18, that means I need the selected AC (dependent on J2) labeled cells in the c column, add their adjacent D column bonus then add them up

Upvotes: 1

Views: 364

Answers (2)

player0
player0

Reputation: 1

you can also do:

=SUM(FILTER(D3:D18, C3:C18=J2))

Upvotes: 1

JPV
JPV

Reputation: 27262

Not completely sure if I understood correctly, but maybe sumif() will work?

=sumif(C3:C18, J2, D3:D18)

Upvotes: 1

Related Questions