07-06-2012 02:13 AM
hello everybody!!
well, i am trying to make a programm trhat compares two excel comlumns. What i want to do is to write some words that appearsin one column of the excel file and the programn give me the wird is in the other colmn for example:
|A | RED
|B | BLUE
|C | GREEN
|D | GREY
|E | WHITE
|F | YELOW
SO FOR EXAMPLE IF I WRITE A, the programm will return us RED, IF I WRITE C... GREEN...
CAN SOMEONE HELP ME OR MAKE SOMETHING??PLEASE?
|G
07-06-2012 03:18 AM
First you should read the two Excel columns into a 2D array. Then you just search the first column to match the user input. If it's a match you'll get the index. Use this index to index out the second column containing the colors. Display the result with a string indicator.
07-06-2012 06:33 AM
For the first part, look in the examples (Help -> Find Examples). There's one there that shows you how to read an Excel file.
07-09-2012 06:25 AM
hi!!! i don't get what i want!! here yo have the program i make, can you help me?
07-09-2012 06:28 AM
sorry so now what i want is to show me the row and index selected!!or something like this!!!
|A | RED
to show me a window or string indicator with red.
do you understand me?
07-09-2012 07:21 AM
You are searching by rows, not columns. When you autoindex a 2D array the rows are indexed out first. You don't need a for-loop to begin with. Use Index Array to peel off the first column, and then feed that to Search 1D Array. You can use the found index to drive the case structure. If it's -1, then it wasn't found. Anything else, it was. Wire the found index into another Index Array that extracts the appropriate element from the second column. See attached snippet for the basic idea.
Why are you searching for the word "TIME"? Your example showed letters in the first column.
Also: Do not hard-code paths. Always provide a front panel path control.
07-09-2012 04:10 PM
07-10-2012 04:55 AM
hi!! THANKS FOR ALL!
BUT NOW IF I WANT TO SEARCH AN ARRAY IN THE EXCEL FILE, HOW CAN I DO IT???
FOR EXAMPLE:
A | RED
|B | BLUE
|C | GREEN
|D | GREY
|E | WHITE
|F | YELOW
I WILL WRITE THIS ARRAY
|A |
|C |
|F |
THE RESULT PCC WILL GIVE ME:
RED
GREEN
YELOW
DO YOU UNDERSTAND ME, I KNOW HOW TO SEARCH A STRING IN THE EXCEL FILE BUT A ARRAY I CAN NOT SEARCH...
07-10-2012 07:10 AM - edited 07-10-2012 07:18 AM
If you're going to yell at us why should we respond?
Besides, did you even look at the code I posted?
The vlookup method suggested by ben64 is done via ActiveX. You can look over at MSDN for documentation on how to use that function.
07-11-2012 01:34 AM
yes i havve seen your code, but what i want is to search an aarray inside a excel file no only a simple word...thats it!!!!