COUNTIF text field for pasted data

seh0872

New Member
Joined
Nov 15, 2021
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
So...I'm trying to use COUNTIF to count all cells with text data in a column formatted as text. I've used the formula COUNTIF($A:$A,"*") to accomplish this. Works fine if I type the data in. But much of the data is pasted from another source (using paste values). The COUNTIF formula will NOT consider any pasted data.

For the simple formula, I could convert from COUNTIF to COUNTA, but this won't work for my two variable formulas (COUNTIFS).

What gives? Any ideas? I need the cells to be text format to ensure that the leading zeros are not just showing, but are included in another cell that concatenates that data.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
The COUNTIF function does not care whether data was pasted or not. Can you show an example of what data you have, and what the incorrect result of COUNTIF is?

This column is formatted as Text. I put three values in it. I copied those values to other cells, then copied them back to column A. Result is correct:

$scratch.xlsm
ABC
10001236
2000456
3000789
4000123
5000456
6000789
COUNTIF demo
Cell Formulas
RangeFormula
C1C1=COUNTIF(A:A,"*")
 
Upvote 0
In exploring the dataset to answer you, I discovered the issue. The original data from which I am sourcing the data has data in both text format and number format. The format in the ribbon says "text" for the entire column, but certain cells are clearly not text. As soon as I add a leading zero, it "converts". I wonder if this is the opposite of the numbers stored as text problem (in this case I have text stored as numbers).

Using the "Text to Columns" trick converted all data to text, then pasted it and -- voila! -- all is OK.

Just another problem of Excel being secretive and frankly lying to you about how it is reading the data.
 
Upvote 0
The format in the ribbon says "text" for the entire column
If you select more than one cell, or an entire column, and the formatting is not the same in all cells of the selection, the format box will show the format for the upper-left cell of the selection.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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