trying to make if formula work

nickyd15

New Member
Joined
Mar 13, 2011
Messages
6
Hi all and thanks in advance for your help and sorry if none of this makes sence

i am trying to make the following formula work with text in all cells

=IF(A2=Sheet4!B2,Sheet4!C2)+IF(A2=Sheet4!B3,Sheet4!C3)+IF(A2=Sheet4!B4,Sheet4!C4)+IF(A2=Sheet4!B5,Sheet4!C5)+IF(A2=Sheet4!B6,Sheet4!C6)

all cells involved are text
the first part of the function works
=IF(A2=Sheet4!B2,Sheet4!C2)
so a2 is nick and sheet4b2 s nick so the formula returns the text from sheet4c2 which is alonso

but as soon as you add the rest of the formula it returns #value!

i know that this would work with numbers but cannot for the life of me figure out how to make it work with text

any helpwould be great
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Well....to "fix" your formula, you need to replace the plus signs (+) with ampersands (&) (because you're combining text, not adding numbers) and add an empty string for the non-matches:
Code:
=IF(A2=Sheet4!B2,Sheet4!C2,"")&IF(A2=Sheet4!B3,Sheet4!C3,"")
&IF(A2=Sheet4!B4,Sheet4!C4,"")&IF(A2=Sheet4!B5,Sheet4!C5,"")
&IF(A2=Sheet4!B6,Sheet4!C6,"")

But, to use a more maintainable formula, try this:
Code:
=IF(COUNTIF(Sheet4!B2:B6,A2),INDEX(Sheet4!C2:C6,MATCH(A2,Sheet4!B2:B6,0)),"")
Does that help?
 
Upvote 0
Hi all and thanks in advance for your help and sorry if none of this makes sence

i am trying to make the following formula work with text in all cells

=IF(A2=Sheet4!B2,Sheet4!C2)+IF(A2=Sheet4!B3,Sheet4!C3)+IF(A2=Sheet4!B4,Sheet4!C4)+IF(A2=Sheet4!B5,Sheet4!C5)+IF(A2=Sheet4!B6,Sheet4!C6)

all cells involved are text
the first part of the function works
=IF(A2=Sheet4!B2,Sheet4!C2)
so a2 is nick and sheet4b2 s nick so the formula returns the text from sheet4c2 which is alonso

but as soon as you add the rest of the formula it returns #value!

i know that this would work with numbers but cannot for the life of me figure out how to make it work with text

any helpwould be great
Try it like this...

=VLOOKUP(A2,Sheet4!B2:C6,2,0)
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,777
Members
452,942
Latest member
VijayNewtoExcel

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