3
I have a database composed of two vectors: u=(a,b,c)
and v=(1,2,3)
In another spreadsheet, I have two empty vectors x
and y
. I need you to complete an entry of x
(coming from u
), the code return me the corresponding entry of v
in x
.
For example, if x = (b,c,b)
, then y =(2,3,2)
Thank you!
Hi Mariana. Have you tried using the functions
vlookup
orhlookup
?– Luiz Vieira
Hello Luiz, actually my doubt is on how to get a return with the data of the second vector. All vectors are already defined. In vector x, I will type a value, and if this value is equal to one of the inputs of vector u, then I want it to return me the corresponding input of vector y in vector v.
– Mariana
I understood later, so I removed the comment and posted another. Add one screenshot how is your spreadsheet. But an idea is you use one of the functions of lookup that I mentioned to search for the letter and return the value. You probably don’t need VBA. One more example: http://blog.luz.vc/excel/como-usar-funcao-procv-vlookup-excel/
– Luiz Vieira
I am opting for VBA because the vectors will be very large
– Mariana
If Excel can store/represent, it makes no difference. Excel’s native functions work well enough. VBA is only necessary when you need to build something that you can’t do only using native Excel resources. :)
– Luiz Vieira
Okay, I’ll try, thanks for the help!
– Mariana
Not at all. If you can solve it, please post an answer yourself with the detailed solution. So you also help other people who may have the same doubt in the future. :)
– Luiz Vieira
P.S.: I’m imagining that the values of each component of the vectors are in separate columns or rows, and so you can use the functions of lookup quietly. If it’s just a string, you’ll need to separate everything (and then, in this case, you might even need VBA). That’s why I said, post more details on how the contents of your file are.
– Luiz Vieira