Phi Huynh
Phi Huynh

Reputation: 197

Excel get cells value if cells contain specific text

enter image description here

I have Table 1 & 2 like image. How i can get all cells value if ID is equals?

Upvotes: 0

Views: 230

Answers (1)

xarxziux
xarxziux

Reputation: 371

If you just need to add numbers, there are formulas for this, but I'm not sure if there's a single formula for adding string values as in the provided example. One way to resolve this is by using accumulator columns as in this screen shot:

enter image description here

The formula in cell C3 is:

=IF($A3<>C$1,C2,IF(C2=0,$B3,C2&", "&$B3))

Copy this down to cell E10 (or wherever that table needs to end) and columns C to E will accumulate the values from column B. Table 2 then just maps the first and last rows of the accumulator columns. The zeros in cells C2 to E2 is a work-around to prevent Excel from converting blank cells into zeros.

Hope this helps!

Upvotes: 1

Related Questions