Daily tips for using Microsoft Excel.

Friday, March 15, 2002

Siobhan asks I'm running a perl script which opens a batch file which opens an excel spread sheet and since i upgraded to win2k the stub that i had for opening it automatically will not work. It always asks me to enable macros. Is there another stub for excel 9.0 or excel 2000 which will do this and that I can download?

One solution would be to go to Excel, do Tools > Macro > Security and set the security setting to Low. This will eliminate the question about the macros. Not that I would recommend setting the security to low...

Another possibility is a short VB6 program that would open the Excel file. If you open an Excel file with VB6, you eliminate the enable macros warning.




Saturday, March 02, 2002

Chris asks "What I actually need is a function that will examine a range of cells and returns a certain value if any one of the cells in the range contains a certain word. Is there such a function?"

Assuming this data is in A1:A4

{"Juan";
"Pablo";
"Gonzalez";
"Juan Pablo"}

And you want to test for the existance of "Juan", (Located in C1), you could use, for example:

{=IF(LEN(C1)*OR(ISNUMBER(SEARCH("*"&C1&"*",A1:A4))),"Exists","Doesn't Exist")}

=IF(LEN(C1)*ISNUMBER(MATCH("*"&C1&"*",A1:A4,0)),"Exists","Doesn't Exist")

=IF(LEN(C1)*COUNTIF(A1:A4,"*"&C1&"*"),"Exists","Doesn't Exist")

The first one is a CSE formula (Must be entered pressing Control Shift Enter), the second and third one are regular formulas.

First one is also case sensitive.

Friday, March 01, 2002

Jon asks "I am using the the Max function, and have a table for which i want to show the largest value. I do not want the actual value to be shown though, i want the corresponding title to be shown how do I do this?
The Table looks like this(though on a larger scale):
C other columns Q
Crisps 100
Chocolate 345
Sweets 54

How do i get it (without using IF as the table is much too big) to show for the maximum value 'Chocolate' instead of '345'"


If you need multiple IF's, chances are that you're using the wrong formula !!... try with this one instead:

=INDEX(C:C,MATCH(MAX(Q:Q),Q:Q,0))