Countif vba???

SAMCRO2014

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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about, something like this just copied down.
=COUNTIF(F$2:F$100,F2)
 
Upvote 0
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!!!

[TABLE="width: 283"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]PRI[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Results S/B [/TD]
[/TR]
[TR]
[TD]10753605[/TD]
[TD]19-04-01[/TD]
[TD]19-10-18[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-04-01[/TD]
[TD]19-09-08[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-04-01[/TD]
[TD]19-09-08[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-09-09[/TD]
[TD]19-10-18[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-09-09[/TD]
[TD]19-10-18[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]19234996[/TD]
[TD]19-04-01[/TD]
[TD]19-04-26[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]19234996[/TD]
[TD]19-07-02[/TD]
[TD]19-08-18[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]19234996[/TD]
[TD]19-08-19[/TD]
[TD]19-09-30[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]19234996[/TD]
[TD]19-10-01[/TD]
[TD]19-10-18[/TD]
[TD] 1[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
What did you try?
And what date?
 
Last edited:
Upvote 0
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.

[TABLE="class: cms_table, width: 283"]
<tbody style="border-collapse: collapse; border-spacing: 0px 0px; font-size: 13px; margin-bottom: 0px;">[TR]
[TD]PRI[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Results S/B[/TD]
[/TR]
[TR]
[TD]10753605[/TD]
[TD]19-04-01[/TD]
[TD]19-10-18[/TD]
[TD] 1[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-04-01[/TD]
[TD]19-09-08[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-04-01[/TD]
[TD]19-09-08[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-09-09[/TD]
[TD]19-10-18[/TD]
[TD] 2[/TD]
[/TR]
[TR]
[TD]17260035[/TD]
[TD]19-09-09[/TD]
[TD]19-10-18[/TD]
[TD] 2[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
How about
=COUNTIFS(F:F,F2,G:G,G2,H:H,H2)
 
Upvote 0
My pleasure & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,994
Members
452,542
Latest member
Bricklin

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