Formula problem

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,566
Office Version
  1. 2021
Platform
  1. Windows
I have formula below which extract the highest month in a column from another workbook.

where the result is less than the current month, I want to use the current month and year, but cannot get the formula to work. The current month and year is in cell E1



Code:
 =if(TEXT(MAX('C:\My Documents\[BR 898885 (91587 -sales).xls]Details'!$C$1:$C$65536),"mmmm-yyyy)<E1,E1),TEXT(MAX('C:\My Documents\[BR 898885 (91587 -sales).xls]Details'!$C$1:$C$65536)


It would be appreciated if someone can assist me
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
i think you have a bracket in the wrong place and a missing "
=if(
TEXT(MAX('C:\My Documents\[BR 898885 (91587 -sales).xls]Details'!$C$1:$C$65536),"mmmm-yyyy")<E1,
E1),
TEXT(MAX('C:\My Documents\[BR 898885 (91587 -sales).xls]Details'!$C$1:$C$65536
)

is E1 formatted as a date or also TEXT in the same format as MMMM-YYYY ?
if it does not work after removing the bracket
try
Just using in a cell

TEXT(MAX('C:\My Documents\[BR 898885 (91587 -sales).xls]Details'!$C$1:$C$65536),"mmmm-yyyy)
what do you return
is it a number or the date format , change format to general and it shoulkd stay the same

change format of E1 to general and for it to work you should still see MMMM-YYYY format

A date is a number and text will not be seen as a date and so not be less than
 
Upvote 0
Thanks for pointing out my error. Problem now resolved
 
Upvote 0
Thanks for pointing out my error. Problem now resolved
Just looking at your question and Wayne's reply, have you amended your dates to proper dates now? If not then you will still likely encounter problems.

With text dates in the format of "mmmm-yyyy" the months will evaluate alphabetically, i.e. your formula of TEXT(....)<E1 would see the months in the order of April, August, December, February, January, July, June, March, May, November, October, September.
Also, if the date range covers more than 1 year then it would mean that (for example) August 2020 would be before December 2019 in the alphanumeric hierarchy.
 
Upvote 0
Hi Jason

Thanks, the dates are correctly formatted
 
Upvote 0

Forum statistics

Threads
1,215,529
Messages
6,125,344
Members
449,219
Latest member
Smiqer

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