Countif is just not working

RockandGrohl

Active Member
Joined
Aug 1, 2018
Messages
497
Office Version
  1. 2010
Platform
  1. Windows
Hello

My sheet has two elements, the Main tab which has a list of 10,000 6-letter codes down column A . And a temp sheet which has a similar amount of rows.

I'm doing a countif on the temp sheet to see which rows are already in the Main sheet:

Excel Formula:
=COUNTIF('Main'!$A:$A,Temp!$A2)

This is returning 0 for every code in the Temp sheet, even though I know for a fact that the cells it's looking for exist. For example, one cell is "M64686" and it is EXACTLY "M64686" on the other sheet. In addition, the cells are both formatted the same, there are no leading or trailing spaces.

I have tried clicking in the cell and pressing enter, which usually works. It hasn't this time. I've also done text-to-columns and even some VBA such as:

VBA Code:
Do until cells(activecell.row, "A").value = ""
Activecell.value = activecell.value
activecell.offset(1,0).activate
Loop

This usually helps, as the Temp sheet originates from a CSV which is copied over into the temp file and sometimes we need to overwrite the value with the value to make it confirm as the correct format and be readable by Vlookups etc.

Any ideas? Thanks.
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

RockandGrohl

Active Member
Joined
Aug 1, 2018
Messages
497
Office Version
  1. 2010
Platform
  1. Windows
Solved, lol, I was looking into "Temp" but I created a new sheet and called it "TMTemp" - what a parsnip I am.
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,122,450
Messages
5,596,221
Members
414,046
Latest member
mbeutler1203

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
Top