# COUNTIF in a list that contains numbers formatted as text

#### HMSTPI

##### New Member
Excel 2013 64-Bit: I have a list of text that will NOT count correctly (to get the alphabetical order) and, for the first time I know of, I am unable to find any previous discussion anywhere that is relevant.
 A B C D 1 ITEM ORDER FORMULATEXT CORRECT ORDER 2 1062287 0 =COUNTIF(\$A\$2:\$A\$6,"<="&\$A2) 1 3 1062740 Folio 2 =COUNTIF(\$A\$2:\$A\$6,"<="&\$A3) 2 4 1063209 Part 3 =COUNTIF(\$A\$2:\$A\$6,"<="&\$A4) 3 5 1063648 0 =COUNTIF(\$A\$2:\$A\$6,"<="&\$A5) 4 6 1063832 Folio 5 =COUNTIF(\$A\$2:\$A\$6,"<="&\$A6) 5

<tbody>
</tbody>

Column A and the values within are formatted as TEXT.. When that alone didn't work, I added ' to the beginning of the text in A2 and A5. The ORDER will NOT calculate correctly no matter what I try because it insists on treating A2 and A5 as values. Any suggestions other than adding space or concatenating it with another text value (which I already confirmed does work but SHOULDN'T BE NECESSARY)?

Thanks!

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

##### MrExcel MVP
Try...

=SUMPRODUCT(--(\$A\$2:\$A\$6&""<=A2&""))

#### mart37

##### Active Member
=sumproduct((\$a\$2:\$a\$6<=\$a2)*1)

#### HMSTPI

##### New Member
Neither option seem to give the right answer. I ended up having to create a different field to concatenate some text in front of the real sorting target to get it to work. All the years I've worked with Excel -- the text/number/number/text inconsistencies and/or auto-treatment STILL finds a new way to drive me crazy!!!

THANKS for such a quick response though I had already moved on and took this long to reply!!

1,102,774
Messages
5,488,774
Members
407,658
Latest member
Arias610

### This Week's Hot Topics

• Timer in VBA - Stop, Start, Pause and Reset
[CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
• how to updates multiple rows in muliselect listbox
Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
• Delete Row from Table
I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
• Assigning to a variable
I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
• Way to verify information
Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
• Active Cell Address – Inactive Sheet
How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...