Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sum values in a row

Posted on 2015-01-05
4
Medium Priority
?
105 Views
Last Modified: 2015-01-05
Instead of using several vloopup formulas and adding them up to get a value, is there an Offset or Match Function that will look at a text in a cell and convert it to it's corresponding value and sum it all up in one cell.

Example
H = 9
M = 5
L = 2

A1         B1           C1            D1             E1
H           M             L               M             21

The total for this A - D is 9+5+2+5 = 21
0
Comment
Question by:ablove3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 40531908
If you list the Letters in ascending alphabetic order on the side somewhere, with the corresponding values in the next column, then you can use something like:

=SUMPRODUCT(LOOKUP(A1:D1,$M$1:$M$3,$N$1:$N$3))

where

where M1:N3 contains the table of values with column M in ascending alpha order.
0
 
LVL 23

Accepted Solution

by:
NBVC earned 2000 total points
ID: 40531913
Or if those are the only 3 characters, then you can avoid the side table with formula like:

=SUMPRODUCT(LOOKUP(A1:D1,{"H","L","M"},{9,2,5}))

again, first array must be in ascend. alpha. order
0
 

Author Closing Comment

by:ablove3
ID: 40531964
That's exactly what I was looking for.  Thank you
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40532005
Here is a User Defined Function that will behave just like a normal function.

Place =SumLetters(A1:D1) in E1 and copy down.
Function SumLetters(r As Range) As Integer

Dim intValue(65 To 90) As Integer
Dim lngCol As Long

' Uncomment other letters as needed and replace the question
' mark with their values
'intValue(65) = ? 'A
'intValue(66) = ? 'B
'intValue(67) = ? 'C
'intValue(68) = ? 'D
'intValue(69) = ? 'E
'intValue(70) = ? 'F
'intValue(71) = ? 'G
intValue(72) = 9 'H
'intValue(73) = ? 'I
'intValue(74) = ? 'J
'intValue(75) = ? 'K
intValue(76) = 2 'L
intValue(77) = 5 'M
'intValue(78) = ? 'N
'intValue(79) = ? 'O
'intValue(80) = ? 'P
'intValue(81) = ? 'Q
'intValue(8?) = ? 'R
'intValue(83) = ? 'S
'intValue(84) = ? 'T
'intValue(85) = ? 'U
'intValue(86) = ? 'V
'intValue(87) = ? 'W
'intValue(88) = ? 'X
'intValue(89) = ? 'Y
'intValue(90) = ? 'Z

For lngCol = r.Column To r.Column + r.Columns.Count - 1
    SumLetters = SumLetters + intValue(Asc(Cells(r.Row, lngCol)))
Next
End Function

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question