Subtracting data sets using Vlookup

andyb16

Board Regular
Joined
Apr 19, 2011
Messages
77
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.


Not sure what I am missing. Please help! thx.
EMPLID</SPAN>April hrs set 1</SPAN>EMPLID</SPAN>April hrs set 2</SPAN>
55518</SPAN>186</SPAN>55518</SPAN>176</SPAN>
72542</SPAN>202</SPAN>72542</SPAN>168</SPAN>
7551</SPAN>24</SPAN>7551</SPAN>168</SPAN>
44496</SPAN>187</SPAN>44496</SPAN>168</SPAN>
50265</SPAN>193</SPAN>50265</SPAN>176</SPAN>
82825</SPAN> 82825</SPAN>168</SPAN>
4665</SPAN> 4665</SPAN>178.5</SPAN>
55155</SPAN>190</SPAN>55155</SPAN>165</SPAN>
12585</SPAN>71</SPAN>12585</SPAN>176</SPAN>
27556</SPAN> 27556</SPAN>168</SPAN>
10040</SPAN>144</SPAN>10040</SPAN>136</SPAN>
45588</SPAN>167</SPAN>9500</SPAN>186</SPAN>
54906</SPAN>161</SPAN>45588</SPAN>176</SPAN>
7514</SPAN>206</SPAN>54906</SPAN>174</SPAN>
58949</SPAN>209</SPAN>7514</SPAN>172</SPAN>
66775</SPAN>110</SPAN>49517</SPAN>168</SPAN>
82552</SPAN>172</SPAN>58949</SPAN>171</SPAN>
70556</SPAN>194</SPAN>66775</SPAN>120</SPAN>
54272</SPAN>177</SPAN>82552</SPAN>160</SPAN>
9049</SPAN>178</SPAN>70556</SPAN>168</SPAN>
54272</SPAN>160</SPAN>
9049</SPAN>160</SPAN>

<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.
 
Upvote 0
Andy,
How about something like this?
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.
 
Upvote 0

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top