# Formula for Comparisons and Subtraction

#### Glasgowsmile

##### Board Regular
Good Morning,

I've posted a photo so you can see what I'm doing but basically...

I want to compare two columns and then subtract the numbers next to them if they match.

I want to compare column K and column N, find the matches and then subtract column L from column O to paste into column Q.

https://imgur.com/kwG55fr

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

may be

#### Glasgowsmile

##### Board Regular
This is great, how could I expand this if I increase the data set?

For example, let's say K:L are Week 1, N:O are Week 2. What if I wanted to add a Week 3 / 4 and it compares across all 4 weeks what the changes are?

#### AlanY

##### Well-known Member
it's basically just copy the formula across

#### Glasgowsmile

##### Board Regular

Not quite what I had in mind, what if I wanted a column that was Week 1 vs Week 2 Comparison and then another Column that compared Week 1 to Week 2 & 3, and then a 3rd that compared Week 1 to 2, 3, & 4?

#### AlanY

##### Well-known Member
Not quite what I had in mind, what if I wanted a column that was Week 1 vs Week 2 Comparison and then another Column that compared Week 1 to Week 2 & 3, and then a 3rd that compared Week 1 to 2, 3, & 4?

say for A

Wk1 10
Wk2 9
Wk3 8
Wk4 7

what results are you expected for compared Week 1 to Week 2 & 3, and
Week 1 to 2, 3, & 4 ?

#### Glasgowsmile

##### Board Regular
For example for A, I'm trying to see how A has grown or declined over the last 3 weeks compared to week 1 - so I want to compared week 1 against all other weeks to pull A-G, in this example, so I can see how it stacks up over time.

#### AlanY

##### Well-known Member
ok, have a look of this

Replies
2
Views
120
Replies
4
Views
65
Replies
1
Views
44
Replies
8
Views
74
Replies
3
Views
71