One cell calculation

[Solved/Closed]
Report
-
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
-
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 replies

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
800
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
Posts
138
Registration date
Thursday January 21, 2010
Status
Member
Last seen
May 8, 2019
6
i paste this code in macro but what i type in excel to get the result ?

like =subtest(A1) or something else
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
800
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
clcik tools(menubar of the sheet)-macro-macaro
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
if i have 600.00 in cell b and want the formular for the percentage of that sum in cell d how do i do that
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
800
thre is not cell b but cell b1 , b2 etc simiarly for d or any other column

suppose b1 has entry 1
d1 has entry 2
in empty cell type
=b1/d1
for mat this cell as perecentage.

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!