COUNTIF and LEFT/MID/RIGHT

Woodpile

New Member
Joined
Sep 14, 2007
Messages
38
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello all,

I am hoping this can be done. I have tried to configure every combination I can think of but I am not skilled enough with Excel to figure it out.

Here is the situation:

I have a range of cells (C2:N156) with data in them. This data is a 3-digit number in each cell (stored as text because of leading zeroes) and I would like to create a simple chart totaling how many times of each single digit appears.

I have used the LEFT, MID and RIGHT functions to separate out this information before but I need to do it on a larger scale. I am hoping there is a way to combine COUNTIF and LEFT/MID/RIGHT in a range of cells.

I hope I am explaining this well enough. What I tried was something like this =COUNTIF(C2:N156, ((LEFT, 1) =1)), hoping it would return the number of times "1" appears in the first position in each cell in the range C2:N156. From there I can adjust the formula to meet the other 9 possible digits and the other two positions.

I tried variations on this theme and it appears LEFT in the example above cannot be qualified to a single value.

Overall, I am trying to create a graph showing the distribution of each digit to prove randomness. The data is from a raffle-type fundraiser I run for a non-profit organization I belong to. This raffle is licensed through the state and if I am audited, I would like to easily prove our method for drawing the numbers is truly random.

Thanks, at least, for reading this far. I am hoping the Excel gurus here can help!

Ed
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Ed,

Not a ful set of data but maybe this will help....

Array formula in Q2 and drag down and across.


Excel 2007
CDEFGHIJKLMNOPQRS
1Digit1st Pos2nd Pos3rd Pos
2024895003024895003024895003024895003032161
312935347212935347212935347212935347211500
4024895003024895003024895003024890003203116
5129353472129353972129353472129353472316032
6024895003024895003024895003024895003415016
7129353472129353472129353472129353472501615
80248950030248950030248950030248950036000
912935347289935347212935347212935347270160
1081700
11911716
Sheet9
Cell Formulas
RangeFormula
Q2{=COUNT(1/(MID($C$2:$N$156,COLUMNS($Q:Q),1) =TEXT($P2,"@")))}
Press CTRL+SHIFT+ENTER to enter array formulas.


<tbody>
</tbody>
 
Upvote 0
Here is a slightly different approach using the same set up as Tony:

Excel Workbook
CDEFGHIJKLMNOPQRS
1Digit1st Pos2nd Pos3rd Pos
2024895003024895003024895003024895003032161
312935347212935347212935347212935347211500
4024895003024895003024895003024890003203116
5129353472129353972129353472129353472316032
6024895003024895003024895003024895003415016
7129353472129353472129353472129353472501615
80248950030248950030248950030248950036000
912935347289935347212935347212935347270160
1081700
11911716
Sheet1
 
Upvote 0
Hello Tony,

Thank you for the response. I think I followed your instructions and pasted the formula in to cell Q2 without the brackets. Excel did not insert those brackets and the formula returns a "0" in all cells but the formula does change where it is not locked by the $.

I am running Excel 2007 on a Windows platform so I used CRTL-V to paste into the cell. I also typed it in manually with the same result.

I do appreciate your effort and response.

Ed
 
Upvote 0
FormR,

That one worked. Thanks for your help.

I appreciate the response.

Ed
 
Upvote 0
Ed,

You are right to go with Form's tidier, non-array entry solution.

Just for the record, it sounds very much as if you did not enter my formula correctly. To enter an array formula.... With the cursor in the formula bar hold down the Ctrl and Shift keys and then hit Enter.
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,562
Members
449,171
Latest member
jominadeo

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