Locate Numbers and Write Count

Status
Not open for further replies.

SUSAN BAXTER

New Member
Joined
Apr 1, 2019
Messages
47
I was looking for help on creating some code to find numbers 1 to 20.


The code would search for any numbers 1 to 20, in the ranges E3:E10, F10:F17, H3:H10 (I will need to be able to add additional ranges in the future). A positive result ones that have data in the cell to the right of it (see my example below). When the code has a positive result it would perform a count and write the total results to cell B18.


All cells have numbers in them but most do NOT have any data in the cell to the right of it. The set of number cells are formatted as general.


That would do it. Thanks so much for all your help.




(Cell B18 below)
3


Cell ranges below:


E3
E4
E5 1, cell E6 has 1-1 in it
E6
E7
E8
E9
E10


F10
F11
F12
F13
F14
F15 2, cell F16 has 9-9 in it
F16
F17


H3 20, cell H4 has 20-1 in it
H4
H5
H6
H7
H8
H9
H10


In my above sample data the code would find 3 cells with sets of numbers in the cells to the right of it. First in cell E5 (number 1 with a 1-1 in cell E6), second cell F15 (number 2 with a 9-9 in cell F16) and third H3 (20 with a 20-1 in cell H4). The code would then add up the 3 positive results and write the count 3 to cell B18.


Thanks so much.
<style type="text/css">p { margin-bottom: 0.25cm; direction: ltr; color: rgb(0, 0, 0); line-height: 115%; text-align: left; }p.western { font-family: "Liberation Serif", serif; font-size: 12pt; }p.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 12pt; }p.ctl { font-family: "Lohit Devanagari"; font-size: 12pt; }a:link { }</style>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Status
Not open for further replies.

Forum statistics

Threads
1,215,454
Messages
6,124,933
Members
449,195
Latest member
Stevenciu

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