Greater than if statement not working on text

Jaffabfc

Board Regular
Joined
Jul 5, 2013
Messages
235
Office Version
  1. 365
Platform
  1. Windows
Hi,

So in cell G2 i have the formula of "=text(today(),"yyyy")"
in Cell H2 i have the formula of "=text(today(),"m")"


In cell D2 i have a countif of Column A
In cell C2 i have the formula of "=IF($H$2>D2,$G$2+1,$G$2)"

so what i am trying to get in cell C2 is if d2 is lower than h2 put g2+1 if not put g2 then drag it down

i think i have it in the forumla above but i recon its something to do with text.
Any ideas?

thanks
 
not sure why you are changing to text - is this for other reasons ?
if so
=text(today(),"yyyy")*1
=text(today(),"m")*1

will change the text into a number

or
=YEAR(TODAY())
=MONTH(TODAY())
will keep as a number
 
Upvote 0
not sure why you are changing to text - is this for other reasons ?
if so
=text(today(),"yyyy")*1
=text(today(),"m")*1

will change the text into a number

or
=YEAR(TODAY())
=MONTH(TODAY())
will keep as a number
i always mess up when changing to text, its just a habit always forget the other ways of doing it.
 
Upvote 0
*1 or +0 works
OR use --
=--TEXT(TODAY(),"yyyy")
=TEXT(TODAY(),"yyyy")+0
=TEXT(TODAY(),"yyyy")*1 - I always use *1 no idea why
 
Upvote 0
Month comparisons should usually include the year as well.
For e.g. Is month 01 (January) greater than today's month 03 (March)?
No it's not, 1 is not greater than 3.
Oh, hang on,, I meant Jan in 9 months time, which IS later than this month.
Just doing a month comparison will return FALSE as shown above.
If you include the year 202601 IS greater than 202503.

Back to your problem.
If you're using COUNTIF then A is a number, and you shouldnt be comparing TEXT against a NUMBER.

Try using

=text(today(),"m")+0
 
Upvote 0

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