Macros needed (Count and Sum)

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
Formulas needed

Col AB from lines 19 to 9999
has numbers 0.01 to 750.00

I need to count cells that contain numbers from 10.00 to 19.99
also the sum of those cells
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You can get those values pretty easily without VBA using SUM and COUNTIFS formulas (see: https://exceljet.net/formula/count-cells-between-two-numbers).
If you need it in VBA, note that you can use most Excel function in VBA by prefacing them with Application.Worksheetfunction.
For example:
Code:
Dim myRange as Range
Dim mySum as Double
Set myRange=Range("AB19:AB9999")
mySum = Application.Worksheetfunction.Sum(myRange)
 
Upvote 0
You are welcome Matt.
Post back if you run into any issues implementing it.
 
Upvote 0
Excel 2013/2016
ABC

<tbody>
[TD="align: center"]1[/TD]
[TD="align: right"]0.01[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]64.23[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]0.06[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1.23[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]8.46[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]11.47[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]15.96[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]17.26[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]19.54[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]411.25[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]564.61[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]617.23[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]659.27[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]692.41[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]736.95[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]750[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]B1[/TH]
[TD="align: left"]=COUNTIFS(A1:A15,">9.99",A1:A15,"<20")[/TD]
[/TR]
[TR]
[TH]C1[/TH]
[TD="align: left"]=SUMIFS(A1:A15,A1:A15,">9.99",A1:A15,"<20")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



Maybe something like that?

Oops...guess I had that tab open for a while before posting. :)

EDIT again....I need to just stop for today. Missed the part about needing a macro (you were very clear...it's all my fault). Sorry again.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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