Single digit number is being read as a 2 digit number.

duteberta

Board Regular
Joined
Jun 14, 2009
Messages
89
Office Version
  1. 365
Platform
  1. MacOS
I'm creating an NFL tracker in Excel. I want to enter scores each week in cells in the following format: "6-24". However when I reference that cell later with a formula trying to get the first half of that score it reads it as "60" instead of "6". It's reading the 24 part fine but I cannot get it to read the first part as "6".

Is there a way to fix this without me typing in: "06-24"?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
how are you referening ?
to get 6
then
=textbefore(cell, "-")*1
and
=textafter(cell, "-")*1

Book2
ABC
1
26-24624
Sheet1
Cell Formulas
RangeFormula
B2B2=TEXTBEFORE(A2,"-")*1
C2C2=TEXTAFTER(A2,"-")*1
 
Upvote 0
Can you give us an example of the formula you're trying to use? Do you need them treated as numbers or as test?
 
Upvote 0
The column you enter those values also should be formatted as text first, otherwise Excel is going to treat those kinds of numbers as a date.
 
Upvote 0
It works after adding "*1"- thanks etaf

rankings.xlsx
ABCD
1SCOREWINLOSSTIE
26-24010
test
Cell Formulas
RangeFormula
B2B2=IF(TEXTBEFORE($A$2,"-")*1>TEXTAFTER($A$2,"-")=1,1,0)
C2C2=IF(TEXTBEFORE($A$2,"-")*1<TEXTAFTER($A$2,"-")*1,1,0)
D2D2=IF(TEXTBEFORE($A$2,"-")*1=TEXTAFTER($A$2,"-")*1,1,0)
 
Upvote 0
The IF isn't really necessary, doing math on TRUE/FALSE values coerces them to 1 and 0 (often -- or *1)

Your first one with an =1 seems weird though.

=--(--(TEXTBEFORE($A$2,"-"))>--(TEXTAFTER($A$2,"-")))
=--(--(TEXTBEFORE($A$2,"-"))<--(TEXTAFTER($A$2,"-")))
=--(--(TEXTBEFORE($A$2,"-"))=--(TEXTAFTER($A$2,"-")))
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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