Count if formula data from worksheet and table

Sircotton

New Member
Joined
Mar 26, 2019
Messages
10
Hello.
I am trying to count the occurrences of dates in a table on a different worksheet and have the information counted and added in another worksheet.
I want to count data in table1 on sheet 1 that matches cell (column heading) in sheet 2. The cell (column heading) in sheet2 is configured to be a "date" 1/1, 1/2, and so on. So every time 1/1 appears in sheet1 table1 it will be counted under the corresponding column in sheet 2 in the table. Whenever Sheet1 table1 has 1/2 it will appear under that column with that heading "1/2". So when sheet1 table has a value that matches the column heading in sheet2 it will add up the occurrences under that column in sheet 2. Does that make sence? Sorry its my first time posting.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi Sircotton,

If you could post some sample data, we could work on a solution for you.
 
Upvote 0
Sheet1 has the tables inwhich information and dates to be counted are entered
Sheet1 will have a few different tables. shown below are two tables.

Medications not charted
Med namenurse nametime date
2/1
2/1
2/2
2/3

<tbody>
</tbody>

Medications charted greater than 60 min after removal from machine
Nurse namemedication nametime Date
2/1
2/2

<tbody>
</tbody>

Sheet2 has the table that will total the amount of times a date occurs effectively giving the total amount of occurrences per date
Dates
2/12/22/32/42/52/62/72/82/9
med not charted211
Med charted > 60 min After11

<tbody>
</tbody>

So in Table on Sheet 2, Row 1 I want the cell to add up the dates from table1 that match the heading titled with the corresponding date
In row2 I want the cells to add up the dates from table 2 that match the heading titled with the corresponding date.

I am not quite sure how to attach the actual excel document to the post but maybe this will suffice.
I have tried count if and match but i cannot figure out the formula
 
Upvote 0
Hi Sir,

Maybe this, extend the ranges to suit your data. If these were excel tables we could setup dynamic formulas that would update automatically as you add more rows;


Book1
ABCDEFGHIJK
1Medications not chartedMedications charted greater than 60 min after removal from machine
2Med namenurse nametimeDateNurse namemedication nametimeDate
301-02-1901-02-19
401-02-1902-02-19
502-02-19
603-02-19
Sheet1



Book1
ABCDEFGHIJ
1Dates01-02-1902-02-1903-02-1904-02-1905-02-1906-02-1907-02-1908-02-1909-02-19
2Med not charted211
3Med charted > 60 min After11
Sheet2
Cell Formulas
RangeFormula
B2=COUNTIFS(Sheet1!$D$3:$D$6,">="&Sheet2!B$1,Sheet1!$D$3:$D$6,"<"&(Sheet2!B$1+1))
B3=COUNTIFS(Sheet1!$I$3:$I$6,">="&Sheet2!B$1,Sheet1!$I$3:$I$6,"<"&(Sheet2!B$1+1))
 
Upvote 0
Excel Tables method, select your area and CTRL-T to create tables. I named these Medsnotcharted & Medsgreaterthan60;

1 trick is highlight the row(in my example B2-J2) and paste the table formula in B2, then press CTRL+Enter and this will populate the formula corrrectly.



Book1
ABCDEFGHIJ
1Dates01-02-1902-02-1903-02-1904-02-1905-02-1906-02-1907-02-1908-02-1909-02-19
2Med not charted211
3Med charted > 60 min After11
Sheet2
Cell Formulas
RangeFormula
B2=COUNTIFS(Mednotcharted[Date],">="&Sheet2!B$1,Mednotcharted[Date],"<"&(Sheet2!B$1+1))
B3=COUNTIFS(Medsgreaterthan60[Date],">="&Sheet2!B$1,Medsgreaterthan60[Date],"<"&(Sheet2!B$1+1))
 
Last edited:
Upvote 0
It works. Thank you so much. This will save me so much time at work performing audits. I really appreciate it.
 
Upvote 0
Excel Tables method, select your area and CTRL-T to create tables. I named these Medsnotcharted & Medsgreaterthan60;

1 trick is highlight the row(in my example B2-J2) and paste the table formula in B2, then press CTRL+Enter and this will populate the formula corrrectly.


ABCDEFGHIJ
1Dates01-02-1902-02-1903-02-1904-02-1905-02-1906-02-1907-02-1908-02-1909-02-19
2Med not charted211
3Med charted > 60 min After11

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
B2=COUNTIFS(Mednotcharted[Date],">="&Sheet2!B$1,Mednotcharted[Date],"<"&(Sheet2!B$1+1))
B3=COUNTIFS(Medsgreaterthan60[Date],">="&Sheet2!B$1,Medsgreaterthan60[Date],"<"&(Sheet2!B$1+1))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>


Oh and thank you for posting the "trick". That would have been my next question. haha
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

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