Compare a small string in big string in excel

johnmark123

New Member
Joined
Jun 12, 2014
Messages
4
I have to compare a small tring in a string. For example, I have two columns that are A and B


Code:
     A            B
    test_BL_pa.txt     1
    test_AL_pa.txt     2 
    test_BL_pa.txt     3 
    test_CL_pa.txt     4


With input are test_BL,test_AL,test_CL. I want to get the value at column B corresponding with column A . Hence, given
Output:

Code:
        Input           Value
       test_BL          4(1+3)
       test_AL          2
       test_CL          4


Could you help me for implementation it by excel
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi and welcome to Mr Excel forum

Maybe


A
B
C
D
E
1
test_BL_pa.txt​
1​
Input​
Value​
2
test_AL_pa.txt​
2​
test_BL​
4​
3
test_BL_pa.txt​
3​
test_AL​
2​
4
test_CL_pa.txt​
4​
test_CL​
4​

Formula in E2 copied down
=SUMIF(A:A,D2&"*",B:B)

Hope this helps

M.
 
Upvote 0
Thank you so much. I got it
Hi and welcome to Mr Excel forum

Maybe


A
B
C
D
E
1
test_BL_pa.txt​
1​
Input​
Value​
2
test_AL_pa.txt​
2​
test_BL​
4​
3
test_BL_pa.txt​
3​
test_AL​
2​
4
test_CL_pa.txt​
4​
test_CL​
4​

<tbody>
</tbody>


Formula in E2 copied down
=SUMIF(A:A,D2&"*",B:B)

Hope this helps

M.
 
Upvote 0
Thank Marcelo Branco. Your function works well. How about the other problem. Given the values of column D and E. I want to fill the value of column E into column B, corresponding with string of column D is same with string of column A
A
B
C
D
E
1
test_BL_pa.txt
4​
InputValue
2
test_AL_pa.txt
2​
BL_pa_txt
4​
3
test_BL_pa.txt
4​
AL_pa.txt
2​
4
test_CL_pa.txt
4​
CL_pa.txt
4​



<tbody>
</tbody>
 
Upvote 0
Thank Marcelo Branco. Your function works well. How about the other problem. Given the values of column D and E. I want to fill the value of column E into column B, corresponding with string of column D is same with string of column A

A

B

C

D

E

1
test_BL_pa.txt

4​
Input
Value

2
test_AL_pa.txt

2​
BL_pa_txt

4​

3
test_BL_pa.txt

4​
AL_pa.txt

2​

4
test_CL_pa.txt

4​
CL_pa.txt

4​



<TBODY>
</TBODY>


Not sure if I understood correctly what you need.

Maybe...


A
B
C
D
E
1
test_BL_pa.txt​
4​
Input​
Value​
2
test_AL_pa.txt​
2​
BL_pa.txt​
4​
3
test_BL_pa.txt​
4​
AL_pa.txt​
2​
4
test_CL_pa.txt​
4​
CL_pa.txt​
4​

Formula in B1 copied down
=LOOKUP(9.99E+307,SEARCH($D$2:$D$4,A1),$E$2:$E$4)

M.
 
Upvote 0
It is correct. Thank you so much
Not sure if I understood correctly what you need.

Maybe...


A
B
C
D
E
1
test_BL_pa.txt​
4​
Input​
Value​
2
test_AL_pa.txt​
2​
BL_pa.txt​
4​
3
test_BL_pa.txt​
4​
AL_pa.txt​
2​
4
test_CL_pa.txt​
4​
CL_pa.txt​
4​

<tbody>
</tbody>


Formula in B1 copied down
=LOOKUP(9.99E+307,SEARCH($D$2:$D$4,A1),$E$2:$E$4)

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,450
Messages
6,124,912
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top