Macro VBA excel help - averaging subtotals on a new sheet created by macro

ineedacookie

New Member
Joined
Nov 20, 2009
Messages
3
Hi there, first time trying Mr Excel,

In my sheet I already have a string of macros that copies information onto a newly created sheet. For this new sheet:

All I'd like to to do is write one more macro that will search column B for the text "average", once found, to teh left of that text (in column A), take average of all the numbers ending from 1 cell above, all the way up to where there's a blank cell.

Then after that's done, search for the next "average" below (skipping the blank cells).

There are many, numerous subgroupings all of varying size (2 rows to 50 rows).

Macro can replace existing average number in the cell in ColA.

Here's an example of what sheet created looks like:
ColA ColB ColC
level name
-10 fea
-4 few
-2 feet
-59 average


-10 fea
invalid fea
-4 few
-4 few
-2 feet
45 average


-10 fea
-4 few
-10 fea
-4 few
-10 fea
invalid few
-10 fea
-4 few
-2 feet
2 average

Can you please offer guidance on this?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I this how I would setup?


Sub SortsallwithinAverages()
'
'
Dim lineNum, startLine, endLine As Integer
Dim a, b As Boolean

startLine = -1
endLine = -1

For lineNum = 2 To 1000
a = IsNumeric(Range("A" & lineNum))
b = Range("B" & lineNum).Text = "average"



???
Please help
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top