Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Find First and Last Row Number in Column

Hi All,

I have the following data which will always be sorted/grouped. I
basically want to sum all the A's, B's, and C's values (like a
subtotal)

Column Value
A 2
A 3
A 1
B 3
B 4
B 5
C 6
C 1
C 9

I want to find the the First and last row number A and also for B, so
Start A = 1, End A = 3
Start B = 4, End B = 6
Start C = 7, End C = 9

This issue I have is the column values can differ. For example,
Column
A
A
A
C
C
C

So,
Start A = 1, End A = 3
Start C = 4, End C = 6

Since I know the start and end of each grouping, I can then sum them.
If the column alwas had A,B,and C, then I know how to do this,
however, since it is dynamic, I am not sure how to write code dynamic
enough to handle this.

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Find First and Last Row Number in Column

If the end results are totaling numbers associated with A, B, and C, why not
use a pivot table?

This site will get you started:
http://www.contextures.com/xlPivot01.html


Don Pistulka


"CST" wrote in message
om...
Hi All,

I have the following data which will always be sorted/grouped. I
basically want to sum all the A's, B's, and C's values (like a
subtotal)

Column Value
A 2
A 3
A 1
B 3
B 4
B 5
C 6
C 1
C 9

I want to find the the First and last row number A and also for B, so
Start A = 1, End A = 3
Start B = 4, End B = 6
Start C = 7, End C = 9

This issue I have is the column values can differ. For example,
Column
A
A
A
C
C
C

So,
Start A = 1, End A = 3
Start C = 4, End C = 6

Since I know the start and end of each grouping, I can then sum them.
If the column alwas had A,B,and C, then I know how to do this,
however, since it is dynamic, I am not sure how to write code dynamic
enough to handle this.

TIA



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find First and Last Row Number in Column

sumA =application.Sumif(Columns(1),"A",Columns(2))

SumB = application.Sumif(Columns(1),"B",Columns(2))

SumC = application.Sumif(Columns(1),"C",Columns(2))


will do it without sorting or grouping.

Regards,
Tom Ogilvy

"CST" wrote in message
om...
Hi All,

I have the following data which will always be sorted/grouped. I
basically want to sum all the A's, B's, and C's values (like a
subtotal)

Column Value
A 2
A 3
A 1
B 3
B 4
B 5
C 6
C 1
C 9

I want to find the the First and last row number A and also for B, so
Start A = 1, End A = 3
Start B = 4, End B = 6
Start C = 7, End C = 9

This issue I have is the column values can differ. For example,
Column
A
A
A
C
C
C

So,
Start A = 1, End A = 3
Start C = 4, End C = 6

Since I know the start and end of each grouping, I can then sum them.
If the column alwas had A,B,and C, then I know how to do this,
however, since it is dynamic, I am not sure how to write code dynamic
enough to handle this.

TIA



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Find First and Last Row Number in Column

If the list is in A1 to A9 and values are in B1:B9

then this formula will do what you ask for.

=SUMPRODUCT((A1:A9="A")*1,B1:B9)

Replace the "A" with "B" to sum the rows with B in column A...

Wendel


"CST" skrev i meddelandet
om...
Hi All,

I have the following data which will always be sorted/grouped. I
basically want to sum all the A's, B's, and C's values (like a
subtotal)

Column Value
A 2
A 3
A 1
B 3
B 4
B 5
C 6
C 1
C 9

I want to find the the First and last row number A and also for B, so
Start A = 1, End A = 3
Start B = 4, End B = 6
Start C = 7, End C = 9

This issue I have is the column values can differ. For example,
Column
A
A
A
C
C
C

So,
Start A = 1, End A = 3
Start C = 4, End C = 6

Since I know the start and end of each grouping, I can then sum them.
If the column alwas had A,B,and C, then I know how to do this,
however, since it is dynamic, I am not sure how to write code dynamic
enough to handle this.

TIA



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Find First and Last Row Number in Column

Hi,

You might want to use the SUMIF function...
=SUMIF(A:A,"A",B:B) will sum anything in column A that
is "A" using the values in column B.

Hope this helps...

Chong Moua

-----Original Message-----
Hi All,

I have the following data which will always be

sorted/grouped. I
basically want to sum all the A's, B's, and C's values

(like a
subtotal)

Column Value
A 2
A 3
A 1
B 3
B 4
B 5
C 6
C 1
C 9

I want to find the the First and last row number A and

also for B, so
Start A = 1, End A = 3
Start B = 4, End B = 6
Start C = 7, End C = 9

This issue I have is the column values can differ. For

example,
Column
A
A
A
C
C
C

So,
Start A = 1, End A = 3
Start C = 4, End C = 6

Since I know the start and end of each grouping, I can

then sum them.
If the column alwas had A,B,and C, then I know how to do

this,
however, since it is dynamic, I am not sure how to write

code dynamic
enough to handle this.

TIA
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Find First and Last Row Number in Column

Sweet!!! This worked! Thank you sooooooo much!



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FInd common data in one column then add number in adjacent column JT Excel Worksheet Functions 3 December 18th 09 10:20 PM
Find previous number and find next number in column DoubleZ Excel Discussion (Misc queries) 4 March 4th 09 08:51 PM
How to find what number in Column A is not included in Column B? Zhi Sheng Excel Discussion (Misc queries) 2 September 1st 08 02:42 AM
Find max Row() number for a value in column Vlado Sveda Excel Worksheet Functions 12 January 20th 07 05:32 PM
How do I find the first value in a column less than a number? redeucer Excel Worksheet Functions 6 November 4th 04 09:59 PM


All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"