# One cell calculation

Solved/Closed
Alex - Jan 27, 2010 at 03:12 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 13, 2010 at 09:18 PM
Hello,
Need a programme that calculates sum every time I put in one cell a number. For example, in cell A1 to put the number : 1, 1200, 0.50 and in cell B1 to calculate the sum of ( 1,1200,0.50)
If anyone could help me, Thank you in advance.

## 6 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Jan 27, 2010 at 09:09 PM
As long as there are 3 numbers and configsuration same
first number comma space second number comma space thrid number
then the following macro will get you the result in B1

A formula can be built up but for me it will be complicated.

the macro is

```Sub test()
Dim j, j1, k, k1, m, m1, n
j = InStr(Range("a1").Value, ",")
j1 = Left(Range("A1").Value, j - 1)
k = InStr(j + 1, Range("A1").Value, ",")
k1 = Mid(Range("A1").Value, j + 2, k - 4)
m1 = Right(Range("A1").Value, Len(Range("A1").Value) - k)
n = WorksheetFunction.Sum(j1, k1, m1)
'MsgBox n
Range("B1") = n
End Sub```
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
Jan 28, 2010 at 11:57 PM
i paste this code in macro but what i type in excel to get the result ?

like =subtest(A1) or something else
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Jan 29, 2010 at 05:15 AM
open vb editor (control+F11)
hit control+R
the project window opens on the left side
all the open workbooks names will be there.
highlight this present workbook
click insert(menu bar in vb editor) and cllic module
in the module that coems up copy paste the macro
remember the name of the macro is "test"
save the file
go the sheet
you get the list of macros of all open workbook
highlgith the "test" in the list
and click RUN on the right side
now see B1 of the sheet.

I might have missed some steps like Ok . you take cares of these if necessary.

later you can change the name of the macro as you wish.

if any more doubts revert back to newsgruop
if i want to calculate the percentage of 600.00 in cell b in cell e. how do i do it

Didn't find the answer you are looking for?