sum of "names"

TAlex1st

New Member
Joined
Aug 24, 2011
Messages
3
I have assigned values to several "names" by defining them via Insert/Names/Define.



I want to calculate the sum of a row of cells, where each cell will have have one of the "names" entered.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi TAlex1st,

Welcome to MrExcel!!

For named ranges called "Name1", "Name2" and "Name3" (change to suit), you'd simply put the following formula in whatever cell you wish to see the result:

=Name1+Name2+Name3

HTH

Robert
 
Upvote 0
Except the cells wont have a specific "name" in them. I want it to calculate no matter which combination of my defined "names" are entered into the fields.
 
Upvote 0
Except the cells wont have a specific "name" in them

The cells can be summed by the name you have defined those cells by re my example :confused:

Using my example of named ranges 'Name1', Name2' and 'Name3', you could also use...

=SUM(Name1,Name2,Name3)

...to sum the values held within them.

HTH

Robert
 
Upvote 0
Lets say I'm working with the names: cat, bat, jar and dog. They have numerical values. I want to calculate 3 cells, no matter which 3 names are entered: cat, jar, dog or dog, bat, cat or jar, bat, cat.
 
Upvote 0
Still not sure why you've mentioned the named ranges in your original post, but try this - note you'll have to change the amount each text string is allocated and the cell references where the text string reside:

=IF(ISERROR(INDEX({10,20,30,40},MATCH(A2,{"cat","bat","jar","dog"},0))+INDEX({10,20,30,40},MATCH(A3,{"cat","bat","jar","dog"},0))+INDEX({10,20,30,40},MATCH(A4,{"cat","bat","jar","dog"},0))),0,INDEX({10,20,30,40},MATCH(A2,{"cat","bat","jar","dog"},0))+INDEX({10,20,30,40},MATCH(A3,{"cat","bat","jar","dog"},0))+INDEX({10,20,30,40},MATCH(A4,{"cat","bat","jar","dog"},0)))
 
Upvote 0
Lets say I'm working with the names: cat, bat, jar and dog. They have numerical values. I want to calculate 3 cells, no matter which 3 names are entered: cat, jar, dog or dog, bat, cat or jar, bat, cat.

Excel takes a string in a cell as a string. i.e., it does not attempt to evaluate it in order to see whether it's a name in the name space. But, although not generic, something like...

=SUM(EVAL(A2),EVAL(A3),EVAL(A4))

would do the job. EVAL is a UDF with the following code:

______________________________________________
Public Function EVAL(theInput As Variant) As Variant
'
' if UDF evaluate the input string as though it was on this sheet
' else evaluate for activesheet
'
' Charles Williams aka FastExcel
'
Dim vEval As Variant
Application.Volatile
On Error GoTo funcfail
If Not IsEmpty(theInput) Then
If TypeOf Application.Caller.Parent Is Worksheet Then
vEval = Application.Caller.Parent.Evaluate(CStr(theInput))
Else
vEval = Application.Evaluate(CStr(theInput))
End If
If IsError(vEval) Then
EVAL = CVErr(xlErrValue)
Else
EVAL = vEval
End If
End If
Exit Function
funcfail:
EVAL = CVErr(xlErrNA)
End Function
______________________________________________
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

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