Question: Is there a formula that match data, get the value next to it, and then post that value into another cell?

**This is what my excel sheet looks like:**

```
Sheet A

Column A   |   Column B   |   Column C   |   Column D
----------------------------------------------------------
    Bob                         John           Cat
    John                        Sue            Dog
    Sue                         Bob            Duck

```

John owns a cat, Sue owns a dog, and Bob owns a duck. I want to match Column A to Column C and then grab the value right next to Column C and then put that value back into Column B.

**This is the result that I want:**

```
Sheet A

Column A   |   Column B   |   Column C   |   Column D
----------------------------------------------------------
    Bob          Duck           John           Cat
    John         Cat            Sue            Dog
    Sue          Dog            Bob            Duck

```

Thanks in advance!

Answer: 
using namespace std is your problem.

Looks like the Microsoft implementation of either the iostream or fstream headers themselves include algorithm. This is causing the name clash with std::count().
So, as @Retiredninja suggested, if I choose to replace `while(!in.eof())` with `while(in >> a >> b)` in:

```
while(!in.eof()) {
      in >> a >> b;
      am[a-1][b-1] = 1;
}

```

Does the rest of the code in the while loop remain the same or does it mean, the input has already been read into a and b when the condition is checked in `while(in >> a >> b)`?

And become the following:

```
while(in >> a >> b) {
    am[a-1][b-1] = 1;
}

```

or does it remain:

```
while(in >> a >> b) {
      in >> a >> b;
      am[a-1][b-1] = 1;
}

```