Function within a cell that has a number

  • Thread starter Thread starter Té
  • Start date Start date
T

Té

I have a number in a1 which is 500. Is there a way I can leave the 500 in
place, along with add a formula to that cell as well. I want to add a1+b1,
but I want to keep the 500 there. I know alt + enter goes down to the next
line, but when I insert the formula it doesnt work.
 
if you leave the 500 in the same cell, how are u going to show your result of
the function? explain
 
try this:
=500&A1+A2

If you want space between two then use this

=500&" "&A1+A2

You can add as many equations or text as u like, just add &

Let me know it it worked
 
hmm, it works fiine in mine, are you using excel 2007?

try adding brackets and quatation signs, for example
="500"&(A1+A2)
 
if its giving you 5000, it means its working,
i am sure u dont have any number on A1 and A2, so adding them is 0,
which is why its giving you 500 with a zero in the side, shows up as 5000.
 
I have 500 already in place. What I want to do is keep the number 500, then
on top of that create a formula that adds a1 and b1 together. So I want to
look like
500
600

I have 500 in a1 and 100 in b1. Does that make sense?
 
I have a number in a1 which is 500. Is there a way I can leave the 500 in
place, along with add a formula to that cell as well. I want to add a1+b1,
but I want to keep the 500 there. I know alt + enter goes down to the next
line, but when I insert the formula it doesnt work.

It's not clear to me why you would want to do this; perhaps an easier to
implement solution would become apparent if you were to explain that.

If you were to change the "500", you would also need to re-enter the formula.
This might cause difficulties in the future.

The cleanest method would be to use a separate cell to hold your formula.

In that cell might be a formula similar to:

="500 " & a1+b1

--ron
 
You are getting a circular reference because your formula in A1 is using its
own value to generate a result, which is returned to A1. This is a strange
request, but here is one way to accomplish it (without a circular reference):

The cell (A1) where you want to do this must be formatted to wrap text.

In a VBA module in your workbook, enter this user-defined function:

Function AddToCell(Value1 As Double, Value2 As Double) As String
AddToCell$ = Value1 & vbCrLf & (Value1 + Value2)
End Function

Then, call AddToCell in A1 ilke this:
=AddToCell(500,B1)
where B1 contains 100.

If you are new to user-defined functions (macros), this link to Jon
Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/

Hope this helps,

Hutch
 
Back
Top