# Calculating Sum of count of 2 variables squared per row

1. ## Calculating Sum of count of 2 variables squared per row

In each row I have 6 values, either an A or an R. I have 19 rows. In each row I want to count "A" and square it, and add that to the count of R squared. I can do it row by row (see column H attached) but want to be able to come up with the final sum (418) directly. Every countif and Sumproduct I've tried doesn't come close.

2. ## Re: Calculating Sum of count of 2 variables squared per row

with this udf maybe

``Please Login or Register  to view this content.``
Kind regards
Leo

3. ## Re: Calculating Sum of count of 2 variables squared per row

Try this...

=SUM(MMULT(--(A2:F20="A"),{1;1;1;1;1;1})^2)+SUM(MMULT(--(A2:F20="R"),{1;1;1;1;1;1})^2)

4. ## Re: Calculating Sum of count of 2 variables squared per row

Thanks to both of you. Both excellent suggestions.

5. ## Re: Calculating Sum of count of 2 variables squared per row

You're welcome. Thanks for the feedback!

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1