COUNTIF not working when referencing a table on another sheet

deweywsu

New Member
Joined
Jan 6, 2022
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi.

I am trying to make a dashboard for hiring and departing employees. I have two simple tables on two worksheets respectively. I'm trying to compare the two tables to determine who was hired and who quit. The input tables are made from the list of who is currently employed, which I receive every week. Some names will disappear (these left the company), and some will appear (these were just hired).

On a third sheet, I have a column of formulas that attempts to reference the two 'input' tables with COUNTIF statements. The weird thing is, one of the references works, the other one doesn't give the right results, and I can't figure out why (see the third image below titled "results"). I tried switching the cell format of the two 'input' tables to text and back to general, but no luck. Can anyone help?

If, however, I COPY the results of the two input tables to the same worksheet as the COUNTIF statements, they both work fine (see the last photo with new tables "18" and "29"). I was under the assumption I could reference a table within a formula by name and not have to use the sheet name. Is that wrong? It seems like not, since the first table can be referenced from another sheet just fine.

Most importantly, if there is a better/slicker way to do this, I'd love to know.


Thank you for any help!
-Josh
 

Attachments

  • table 1.png
    table 1.png
    10.5 KB · Views: 57
  • table 2.png
    table 2.png
    13.8 KB · Views: 64
  • results.png
    results.png
    32.4 KB · Views: 64
  • tables 18 and 29.png
    tables 18 and 29.png
    78.9 KB · Views: 65

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
are you only comparing this from one week to another or have a running record for weeks/months/years?
 
Upvote 0
the first one is showing who left, the second is showing who was hired, the third combines them. let me know if this works for you.
-----------
count if hired or fired.xlsx
ABC
1EmplipFull_Name
212345John Ago away
312346Bill Tstayed
412347Lacey Kstayed
512348Bill Bstayed
612349John Tstayed
712350Ron Sstayed
812351Will Sstayed
912352Jim Hstayed
1012353Dana Dstayed
1112354Lindsey Ggo away
1212355Frank Tstayed
1312356Paul Dstayed
1412357Jill Rstayed
1512358Manny Tstayed
16123490sam bstayed
17qweqwestayed
wk1
Cell Formulas
RangeFormula
C2:C17C2=IF(COUNTIF(Week2[[#All],[Full_Name]],Week1[Full_Name])=0,"go away","stayed")
Dynamic array formulas.

-----------
count if hired or fired.xlsx
ABC
1EmplipFull_Name
212346Bill Tstayed
312347Lacey Kstayed
412348Bill Bstayed
512349John Tstayed
612350Ron Sstayed
712351Will Sstayed
812352Jim Hstayed
912353Dana Dstayed
1012355Frank Tstayed
1112356Paul Dstayed
1212357Jill Rstayed
1312358Manny Tstayed
1412359Lenny Khired
1512360Paul Shired
16123490sam bstayed
17qweqwestayed
wk2
Cell Formulas
RangeFormula
C2:C17C2=IF(COUNTIF(Week1[Full_Name],Week2[Full_Name])=0,"hired","stayed")
Dynamic array formulas.

-----------
count if hired or fired.xlsx
ABC
1EmplipFull_Namewk1
212345John Ago away
312346Bill Tstayed
412347Lacey Kstayed
512348Bill Bstayed
612349John Tstayed
712350Ron Sstayed
812351Will Sstayed
912352Jim Hstayed
1012353Dana Dstayed
1112354Lindsey Ggo away
1212355Frank Tstayed
1312356Paul Dstayed
1412357Jill Rstayed
1512358Manny Tstayed
16123490sam bstayed
17qweqwestayed
1812359Lenny Khired
1912360Paul Shired
status
Cell Formulas
RangeFormula
C2:C19C2=IFERROR(VLOOKUP([@Emplip],'wk1'!A2:C17,3,FALSE),"hired")
Named Ranges
NameRefers ToCells
'wk2 (2)'!wk_1=Week1[Emplip]C2
wk_1=Week1[Emplip]C2
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,019
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