ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculating Sum question. (https://www.excelbanter.com/excel-programming/291187-calculating-sum-question.html)

jmon

Calculating Sum question.
 
Hi,

I am new to Excel programming, and not sure if this even requires
macro or not, but here goes.

I want some function, combination of functions, or macros to scan th
first column under Name: and the second colum under Data:(see below).


Note: The name is consecutively sorted already.

If the names match the cell directly below it, then take the sum of th
respective Data: cells, and put the results in the column directly t
the right of that.

Then continue scanning the Name: and Data: columns. If there is n
match just copy the cell one over to the right Result cell. See Tes
B:

This will stop when a blank cell is encountered.


Name: Data: Result:
TEST A 100
TEST A 250 350
TEST B 50 50
TEST C 40
TEST C 50
TEST C 30 120

Any help will be greatly appreciated.

Thank you in advance,
JMO

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Calculating Sum question.
 
Assume you data starts in A1. In C2

put in the formula
=IF(AND(A2<A1,A2<A3),B2,IF(AND(A2=A1,A2<A3),SUM IF(A:A,A2,B:B),""))

then drag fill down your column.

in C1
=if(A1<A2,B1,"")

--
Regards,
Tom Ogilvy


"jmon " wrote in message
...
Hi,

I am new to Excel programming, and not sure if this even requires a
macro or not, but here goes.

I want some function, combination of functions, or macros to scan the
first column under Name: and the second colum under Data:(see below).


Note: The name is consecutively sorted already.

If the names match the cell directly below it, then take the sum of the
respective Data: cells, and put the results in the column directly to
the right of that.

Then continue scanning the Name: and Data: columns. If there is no
match just copy the cell one over to the right Result cell. See Test
B:

This will stop when a blank cell is encountered.


Name: Data: Result:
TEST A 100
TEST A 250 350
TEST B 50 50
TEST C 40
TEST C 50
TEST C 30 120

Any help will be greatly appreciated.

Thank you in advance,
JMON


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com