ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   totaling indented subsections (https://www.excelbanter.com/excel-discussion-misc-queries/101158-totaling-indented-subsections.html)

steev_jd

totaling indented subsections
 

Hi there,

I have a list that has has a list of entries and sub entries in column
A.

Each sub entry is indented, as below
Column A --------------¬------Column B---¬
-(5 spaces)-ABING..............183427
-(7 Spaces)-ABING..............183423
-(7 Spaces)-PAVA.........................2
-(7 Spaces)-EURM.........................1
-(5 spaces)-AEGIS....................524
-(7 Spaces)-AEGIS....................524
-(5 spaces)-JAGA....................1000
-(7 Spaces)-JAGA.....................900
-(7 Spaces)-LEMA.....................100
-(7 Spaces)-GURM.....................15

I need to total the extra indented sections to see if the match the
less indented entry above them.
i.e. in the example above ABING and AEGIS would be correct, JAGA
wouldn't
as 183426 = 183423+2+1 and 524 = 524
but 1000 does not = 900+100+15.

Does anyone have any suggestions as to how I can speed this process up
rather than calculating every section manually?

Thanks in advance.
Steve


--
steev_jd
------------------------------------------------------------------------
steev_jd's Profile: http://www.excelforum.com/member.php...o&userid=33107
View this thread: http://www.excelforum.com/showthread...hreadid=564712


mrice

totaling indented subsections
 

Try this user defined function

Function Check(Cell As Range)
If Left(Cell, 7) = " " Then
Check = ""
Else
Counter = 1
Do While Left(Cell.Offset(Counter, 0).Value, 7) = " "
Total = Total + Cell.Offset(Counter, 1)
Counter = Counter + 1
Loop
If Total = Cell.Offset(0, 1) Then
Check = True
Else
Check = False
End If
End If
End Function

Paste this into a VBA module and type =CHECK(A1) into cell C1 and copy
down.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=564712



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

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