IF ELSE Usage

L84THSKY

New Member
Joined
Apr 24, 2019
Messages
12
Hello

I started a new job and I need help with my excel sheet. I have a column with dates. At the bottom I am using =MAX(F1660:F1680) to result the most recent date. Then I am using =DATEDIF(F1681,TODAY(),"D") to use the result of MAX date to count the number of days since the most recent date compared to the current date.

The problem is when there is no date (only blanks) in the column that MAX is choosing from, it defaults to 1/0/1900. Then the DATEDIF compares 1/0/1900 to the current date and spits out a number such as 43579.

How do I say.... IF MAX is "BLANK" output "" ELSE output MAX?

Or in the other section where DATEDIF is used............IF DATEDIF "greater than 1000" , "0", ELSE DATEDIF

Thanks
Eric
 
Is it all working now?

When I used =IF(MAX(F2:F13)=0,"",MAX(F2:F13)) in a column with the highest date being 9/11/2018, it put 43354. It should have resulted in 9/11/2018
When I used =IF(MAX(F35:F46)=0,"",MAX(F35:F46)) in a column with all blank cells, it put 43354. It should have resulted in a blank space

I think it is just spitting out the 1/0/1900 it always did, just in a numeric result. But when it has values it now won't put the proper value.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
All you've done is re-post post#7.
Yet if you have formatted the cell as a date then this is no longer relevant.

Also what you have posted does not make sense as 43354 is not 1/0/1900
Therefore if you are still having problems, can you please let us know what those problems are?
 
Upvote 0
When I used =IF(MAX(F2:F13)=0,"",MAX(F2:F13)) in a column with the highest date being 9/11/2018, it put 43354. It should have resulted in 9/11/2018
When I used =IF(MAX(F35:F46)=0,"",MAX(F35:F46)) in a column with all blank cells, it put 43354. It should have resulted in a blank space

I think it is just spitting out the 1/0/1900 it always did, just in a numeric result. But when it has values it now won't put the proper value.

43354 is the serial date value for 9/11/2018. Change your cell format from General/Number to Short Date.
 
Upvote 0
Is it all working now?


Yes......The problem I mentioned was because when I inserted your new code, the cell defaulted back to number, when it was orginially a date. I set it back to date and it works.

Now there is an unintended consequence that I hope to resolve. I wan't to be able to cut and paste that formula for all 250 records. The problem is, not all the records have the same # of rows in them, so there isn't an exact pattern to the cells.

Will I have to cut and paste the formula into all 250 records, and keep re-inputting the proper cell group for each record?

Thanks
 
Upvote 0
Without knowing what your data is like, it's difficult to say.
As I'm more VBA based than formulae based It would probably be best to start a new thread for this, explaining what your data is like.
 
Upvote 0
Without knowing what your data is like, it's difficult to say.
As I'm more VBA based than formulae based It would probably be best to start a new thread for this, explaining what your data is like.

It's just more time , but not a huge deal. The important stuff you solved....Thanks for the help; this site is awesome.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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