IF Statement; result incorrect

minnie

New Member
Joined
Apr 25, 2002
Messages
28
=IF(D25>240,240,0)
How do I format the cell so that it comes up with 240? I currently have it formatted as Custom, m and t comes up with 8 instead of 240. 240 represents months.

Cell D25 has the following formula:
=DATEDIF(D22,D23,"M")
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
On 2002-05-01 11:38, minnie wrote:
=IF(D25>240,240,0)
How do I format the cell so that it comes up with 240? I currently have it formatted as Custom, m and t comes up with 8 instead of 240. 240 represents months.

Cell D25 has the following formula:
=DATEDIF(D22,D23,"M")
Sound like you want the NUMBER of months, not the month digit. "m" is for dates, you are asking for a number (I think).
 
Upvote 0
On 2002-05-01 11:38, minnie wrote:
=IF(D25>240,240,0)
How do I format the cell so that it comes up with 240? I currently have it formatted as Custom, m and t comes up with 8 instead of 240. 240 represents months.

Cell D25 has the following formula:
=DATEDIF(D22,D23,"M")

What is m and t?

Your formula

=IF(D25>240,240,0)

comes up with 8?
 
Upvote 0
Hey Minnie,

I believe you want to format your cell with a number format.

I realized that the number 240 appears as the value "8" in a cell when formated with the custom "M" format - this is because 240 is the serial number for the date 8/27/1900 - the month of that date being 8.

Adam
 
Upvote 0
hello Minnie

format the cell with the formula eith a number format.
It works


Andreas
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

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