Using named variables

J

Jessica

I have a user who wants to be able to have a variable (x, e.g.) displayed in
her worksheet, but she wants to be able to assign a value to x, then use the
sum function on rows or columns that include x. I told her how to use a name,
but she really really wants the sheet to display the name, not the value, and
I have been unable to make Excel do that. Is it even possible, without fancy
VB scripting?

Thanks in advance, even if the answer is no
 
H

HITESH

Hi,

I didnt understand your question very properly but have you tried using the
SUMIF function for you problem.

thanks,
Hitesh
 
Z

Zack Barresse

You can use Named Ranges. Hit Ctrl + F3, to bring up the Names dialog box.
Type in the desired name, e.g. "x". Then go to the 'Refers to' box and type
in your value. I would suggest to not use these too often and use with
caution; they can bloat a workbook extremely fast. Plus they are hard to
troubleshoot and use more overhead than just inputting the value.

You can reference a number or a cell using this method.
 
J

Jessica

Well, right, I told the person to use named ranges, but when you are using a
name, and you type =x in a cell, the value of x is displayed, not x. She
wants x to be equal to ten, but she wants the cell to show the letter x, not
the number ten, but she wants to add x + 2 +3 and have the answer be 15.

It's starting to look less and less possible
 
Z

Zack Barresse

Hmm, not sure what happend to my last reply, I'll try this again.

Unless your friend wanted to toggle to Formula view (seeing all formulas and
not their equated values) by hitting Ctrl + ~, then I don't know of any way
to do what they have requested. Sorry.
 
Z

Zack Barresse

If you name the range and are in Formula View (Ctrl + ~) then you will see:

=x+2+3

... or whatever. You won't see the value of 'x'. But you must be in formula
view. You could always stay out of formula view and use another cell to
show the contents of the formula. An example can be found here...

http://www.vbaexpress.com/kb/getarticle.php?kb_id=62

HTH
 
Top