# Countif vba???

#### SAMCRO2014

##### Board Regular
I am trying to find a away to count how may times an employee number shows in Column F and results in Column U. I just can't get it to work with a formula let alone a VBA! I need the information to use in a formula to pro rate costs.

I need the information to look like this:

EE # Results
1111 1
2222 1
3333 2
3333 2
1234 3
1234 3
1234 3

Help!

### Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

#### Fluff

##### MrExcel MVP, Moderator
How about, something like this just copied down.
=COUNTIF(F\$2:F\$100,F2)

#### SAMCRO2014

##### Board Regular
That worked! Now to add another level. For each employee I need to calculate the number of times a date shows up with their employee number. I keep getting zero when I should get an answer of atleast one!!!

 PRI Start Date End Date Results S/B 10753605 19-04-01 19-10-18 1 17260035 19-04-01 19-09-08 2 17260035 19-04-01 19-09-08 2 17260035 19-09-09 19-10-18 2 17260035 19-09-09 19-10-18 2 19234996 19-04-01 19-04-26 1 19234996 19-07-02 19-08-18 1 19234996 19-08-19 19-09-30 1 19234996 19-10-01 19-10-18 1

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>

#### Fluff

##### MrExcel MVP, Moderator
What did you try?
And what date?

Last edited:

#### SAMCRO2014

##### Board Regular
I tried your formula above. OK. Perhaps I give you a bit of detail. I need to pro-rate a cost based per EE number and the same date range (which is variable). So if any employee has only one date range, I need it to return the number 2. The problem is when I have an employee who has several of the same date range. such as in the data above . One employee has two date ranges but are the same. For example Employee 17260035 worked for tow different managers from April 1 - September 8. I have a total costs of \$100. I need something to count those date ranges per EE so 50% of the costs go to one manager and 50% of the costs go to another for that time frame. It could be 25%, 33%, etc.....it is variable.

 PRI Start Date End Date Results S/B 10753605 19-04-01 19-10-18 1 17260035 19-04-01 19-09-08 2 17260035 19-04-01 19-09-08 2 17260035 19-09-09 19-10-18 2 17260035 19-09-09 19-10-18 2

<tbody style="border-collapse: collapse; border-spacing: 0px 0px; font-size: 13px; margin-bottom: 0px;">
</tbody>

#### Fluff

##### MrExcel MVP, Moderator
=COUNTIFS(F:F,F2,G:G,G2,H:H,H2)

#### SAMCRO2014

##### Board Regular
You absolutely rock, Fluff!!!!!! If worked perfectly!!!! Thank you so much!!!

#### Fluff

##### MrExcel MVP, Moderator
My pleasure & thanks for the feedback