ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Code problem (https://www.excelbanter.com/excel-discussion-misc-queries/235762-code-problem.html)

puiuluipui

Code problem
 
Hi, i have this code:
=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8))))-TODAY()),"")
This code it's working only in A1:D1 range, but in U8:X8 range gives me
#REF! error.
Can this be fixed?
Thanks!

Jacob Skaria

Code problem
 
Try this array formula which should work on any range.

=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8)))-COLUMN(U8:X8)+1)-TODAY()),"")

PS: The reason is that COLUMN() returns the column number which is in the
range of 20+ where as the formula uses INDEX() which has got only 4 columns

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i have this code:
=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8))))-TODAY()),"")
This code it's working only in A1:D1 range, but in U8:X8 range gives me
#REF! error.
Can this be fixed?
Thanks!


puiuluipui

Code problem
 
Beautifull!!
Thanks!

"Jacob Skaria" a scris:

Try this array formula which should work on any range.

=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8)))-COLUMN(U8:X8)+1)-TODAY()),"")

PS: The reason is that COLUMN() returns the column number which is in the
range of 20+ where as the formula uses INDEX() which has got only 4 columns

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i have this code:
=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8))))-TODAY()),"")
This code it's working only in A1:D1 range, but in U8:X8 range gives me
#REF! error.
Can this be fixed?
Thanks!


Lars-Åke Aspelin[_2_]

Code problem
 
On Fri, 3 Jul 2009 03:36:01 -0700, puiuluipui
wrote:


Hi, i have this code:
=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired" ,INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8))) )-TODAY()),"")
This code it's working only in A1:D1 range, but in U8:X8 range gives me
#REF! error.
Can this be fixed?
Thanks!



Try this:

=IF(COUNT(U8:X8),IF(TODAY()=MAX(U8:X8),"Expired", INDEX(U8:X8,,MIN(IF(U8:X8TODAY(),COLUMN(U8:X8)-COLUMN(U8)+1)))-TODAY()),"")

Hope this helps / Lars-Åke


All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com