# Subtracting data sets using Vlookup

#### andyb16

##### Board Regular
Hi All,

I have 2 sets of data as below.

The objective is to find the difference in value of hrs against a given emplyee id. I have tried using vlookup to subtract but no luck.

 EMPLID April hrs set 1 EMPLID April hrs set 2 55518 186 55518 176 72542 202 72542 168 7551 24 7551 168 44496 187 44496 168 50265 193 50265 176 82825 82825 168 4665 4665 178.5 55155 190 55155 165 12585 71 12585 176 27556 27556 168 10040 144 10040 136 45588 167 9500 186 54906 161 45588 176 7514 206 54906 174 58949 209 7514 172 66775 110 49517 168 82552 172 58949 171 70556 194 66775 120 54272 177 82552 160 9049 178 70556 168 54272 160 9049 160

<TBODY>
</TBODY><COLGROUP><COL><COL><COL span=2><COL></COLGROUP>

### Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Maybe something like this...(Excel 2007 or higher)

=IFERROR(VLOOKUP(G2,D:E,2,0),0)-IFERROR(VLOOKUP(G2,A:B,2,0),0)

where G2 houses an EMPLID (for example, 9500)

M.

Andy,
Excel Workbook
ABCDEF
1EMPLIDApril hrs set 1EMPLIDApril hrs set 2Difference
2555181865551817610
3725422027254216834
47551247551168-144
5444961874449616819
6502651935026517617
78282582825168-168
846654665178.5-178.5
9551551905515516525
10125857112585176-105
112755627556168-168
1210040144100401368
13455881679500186Not Available in 1st list
145490616145588176-9
15751420654906174-13
1658949209751417234
176677511049517168Not Available in 1st list
18825521725894917138
197055619466775120-10
20542721778255216012
2190491787055616826
225427216017
23904916018
Sheet2
Excel 2003
Cell Formulas
RangeFormula
F2=IF(ISNA(MATCH(D2,A:A,0)),"Not Available in 1st list", VLOOKUP(D2,A:B,2,0)-E2)

Modify the formula as per your needs.

Thanks Guys!!

1,206,710
Messages
6,074,459
Members
446,071
Latest member
Jolon

### 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.

### Which adblocker are you using?

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

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