Countif vba???

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
141
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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,249
Office Version
365
Platform
Windows
How about, something like this just copied down.
=COUNTIF(F$2:F$100,F2)
 

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
141
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!!!

PRIStart DateEnd DateResults S/B
1075360519-04-0119-10-18 1
1726003519-04-0119-09-08 2
1726003519-04-0119-09-08 2
1726003519-09-0919-10-18 2
1726003519-09-0919-10-18 2
1923499619-04-0119-04-26 1
1923499619-07-0219-08-18 1
1923499619-08-1919-09-30 1
1923499619-10-0119-10-18 1

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

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,249
Office Version
365
Platform
Windows
What did you try?
And what date?
 
Last edited:

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
141
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.

PRIStart DateEnd DateResults S/B
1075360519-04-0119-10-18 1
1726003519-04-0119-09-08 2
1726003519-04-0119-09-08 2
1726003519-09-0919-10-18 2
1726003519-09-0919-10-18 2

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

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,249
Office Version
365
Platform
Windows
How about
=COUNTIFS(F:F,F2,G:G,G2,H:H,H2)
 

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
141
You absolutely rock, Fluff!!!!!! If worked perfectly!!!! Thank you so much!!!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,249
Office Version
365
Platform
Windows
My pleasure & thanks for the feedback
 

Forum statistics

Threads
1,077,851
Messages
5,336,744
Members
399,100
Latest member
darcob

Some videos you may like

This Week's Hot Topics

Top