Assign different letters different values across a range of cells

mtaylor

Board Regular
Joined
May 1, 2013
Messages
78
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
  2. MacOS
Hi there, using Google Sheets here

I am inputting the letters G, A and R across D5 to N5

G is to assign the value 7
A is to assign the value 4
R is to assign the value 1

I dont need to see these values just the total please

I'd like the total of these values to total into Cell: D4

Please and thank you
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Paste the formula into cell D4:
Excel Formula:
= SUMPRODUCT( (D5:N5="G")*7 + (D5:N5="A")*4 + (D5:N5="R")*1 )
 
Upvote 0
Solution
What if I wanted to include some cells further along?

For example: D5:O5 but also R5:W5?

I've amended it to this: = SUMPRODUCT( (D5:O5,R5:W5="G")*7 + (D5:O5,R5:W5="A")*4 + (D5:O5,R5:W5="R")*1 )

But I get an error.

Any help would be much appreciated
 
Upvote 0
Hi @mtaylor
What if I wanted to include some cells further along?

For example: D5:O5 but also R5:W5?

I've amended it to this: = SUMPRODUCT( (D5:O5,R5:W5="G")*7 + (D5:O5,R5:W5="A")*4 + (D5:O5,R5:W5="R")*1 )

But I get an error.

Unfortunately this doesn't work.

I'm afraid you'll need to use the SUMPRODUCT function twice like this:
Excel Formula:
= SUMPRODUCT( (D5:N5="G")*7 + (D5:N5="A")*4 + (D5:N5="R")*1 ) + SUMPRODUCT( (R5:W5="G")*7 + (R5:W5="A")*4 + (R5:W5="R")*1 )

or try the whole range starting with the very first cell and ending with the last (but every cell in between will be added if one of the values R, G, A occurs!):
Excel Formula:
= SUMPRODUCT( (D5:W5="G")*7 + (D5:W5="A")*4 + (D5:W5="R")*1 )
 
Upvote 0

Forum statistics

Threads
1,223,914
Messages
6,175,351
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top