Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conditional String Search with Excel?
#1
If have an "apple" and a "X" match
B2 Cell Move
Is it possible to move?
Code:
Copy      Help
A         B        C
1      apple                 O
2      apple                 X
3
4
...
...
...
...
#2
What exactly you want to move?
#3
lionking Wrote:What exactly you want to move?

If I have values ​​that match "Apple" and "X" is this I want to move to that cell.
#4
Where is your value locate at? I mean in what cell?
Could you give an example that you have the value that match "apple" and "X" so that I could have a clear picture of what are you talking about?
#5
lionking Wrote:Where is your value locate at? I mean in what cell?
Could you give an example that you have the value that match "apple" and "X" so that I could have a clear picture of what are you talking about?

I'm sorry, not know English.

For example :
Quote: ExcelSheet KeyFind.Init("")
KeyFind.Activate
ARRAY(Excel.Range) KF
if(!KeyFind.Find("apple" KF)) out "not found."
out KF[0].Value; out KF[0].Column; out KF[0].Row
KeyFind.ws.Application.Goto(KF[0])
wait 1
KeyFind.GetRangeInfo("<sel>" 0 row)
KeyFind.SelectCell(2 row)
out KeyFind
↑Source Code↑"apple" text find
[Image: file.php?mode=view&id=687&sid=38642310ff...73bfaeb5a7]

But, I want Values ​​that match two conditions

For example :
"apple" and "O" = Do not search
"Pineapple" and "O" = Do not search
"apple" and "X" = True(search and A1224 Cell move)


I'm sorry. I don't speak English well.


Attached Files Image(s)
   
#6
So you want to print out the value in B column when the condition matches both "apple" and "X" right?
Here is one solution:

Macro Select Column 1 and 4
Code:
Copy      Help
ExcelSheet es.Init("" 4 "$Documents$\Test1.xlsm")
str s1 s2; int row=1
ARRAY(str) a
rep
,if(!es.GetCell(s1 1 row)) break
,es.GetCell(s2 3 row)
,if (s1="apple" and s2="X")
,,es.GetCell(a[] 2 row)
,row+1
es.Save
for int'i 0 a.len
,out a[i]
#7
OMG! I was surprised.
Thank you very much.
The problem has been solved thanks to ! Big Grin Big Grin Big Grin


Forum Jump:


Users browsing this thread: 3 Guest(s)