user2839261
user2839261

Reputation: 23

Match/Index/Vlookup formula

Trying to create a formula to search 2 columns of text and return value in corresponding cell to the right...so, if I have 4 columns, A & C have text (AA, BB, CC, DD, etc) and columns B & D have numbers (1,2,3,4,etc), I want a formula to search the text of A & C and whichever column the text appears, return the value in B or D directly to the right. Hope this makes sense.

Upvotes: 2

Views: 276

Answers (1)

Jerry
Jerry

Reputation: 71538

Assuming that the columns A & C have unique text and that there are no repetitions, you can use SUMIF:

=SUMIF(A:A,"AA",B:B)+SUMIF(C:C,"AA",D:D)

Otherwise, VLOOKUP would work too:

=IFERROR(VLOOKUP("AA",A:B,2,0),VLOOKUP("AA",C:D,2,0))

EDIT:

As per barry houdini's comment, you can use:

=SUMIF(A:C,"AA",B:D)

for a shorter version of SUMIF.

Upvotes: 2

Related Questions