LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search and compare excel columns

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

0 Kudos
Message 1 of 12
(3,967 Views)

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.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 2 of 12
(3,959 Views)

For the first part, look in the examples (Help -> Find Examples). There's one there that shows you how to read an Excel file.

 

0 Kudos
Message 3 of 12
(3,952 Views)

hi!!! i don't get what i want!! here yo have the program i make, can you help me?

0 Kudos
Message 4 of 12
(3,936 Views)

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?

0 Kudos
Message 5 of 12
(3,934 Views)

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.

0 Kudos
Message 6 of 12
(3,925 Views)

That's sound a lot like the Excel VLookup function. If you're comfortable with ActiveX your can use this function (VLookup) from _Application WorksheetFunction (pass a range reference to Argument 2).

 

Ben64

0 Kudos
Message 7 of 12
(3,911 Views)

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...

 

0 Kudos
Message 8 of 12
(3,896 Views)

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.

0 Kudos
Message 9 of 12
(3,887 Views)

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!!!!

0 Kudos
Message 10 of 12
(3,870 Views)