match the date and paste certain value if not write -9999

sensation

New Member
Joined
Dec 5, 2013
Messages
2
Hi,

I was wondering if someone know how to deal with this topic.

I have to range of dates, one for instance the regular year and the second one, the same year but with some gaps and data going along with.
I am looking for a function that will take each date from the full year and searh for the same date in the range with a gaps and then take its coresponding vvalue if that date exists, if not it should write -9999.

so my date are as follows:

regular yearresult should be like this hereyear with gaps values of years with gaps
01/01/2011 00:00

<tbody>
</tbody>
0.501/01/2011 00:00
0.5
01/01/2011 01:00

<tbody>
</tbody>
-999901/01/2011 02:000.7
01/01/2011 02:00

<tbody>
</tbody>
0.701/01/2011 03:000.4
01/01/2011 03:00

<tbody>
</tbody>
0.401/01/2011 04:000.3
01/01/2011 04:00

<tbody>
</tbody>
0.4etc
etc

<tbody>
</tbody>
i have tried to use look up but didnt manage, if someone can help me would appreciate it.

regards,

marc
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

ABCD
1regular yearresultyear with gapsvalues
2
1/1/2011 0:00​
0.5​
1/1/2011 0:00​
0.5​
3
1/1/2011 1:00​
-9999​
1/1/2011 2:00​
0.7​
4
1/1/2011 2:00​
0.7​
1/1/2011 3:00​
0.4​
5
1/1/2011 3:00​
0.4​
1/1/2011 4:00​
0.3​
6
1/1/2011 4:00​
0.3​

Worksheet Formulas
CellFormula
B2=IFERROR(VLOOKUP(A2,C:D,2,0),-9999)
 
Upvote 0
ABCD
1regular yearresultyear with gapsvalues
2
1/1/2011 0:00
0.5​
1/1/2011 0:00​
0.5​
3
1/1/2011 1:00
-9999​
1/1/2011 2:00
0.7​
4
1/1/2011 2:00​
0.7​
1/1/2011 3:00​
0.4​
5
1/1/2011 3:00​
0.4​
1/1/2011 4:00​
0.3​
6
1/1/2011 4:00​
0.3​

<tbody>
</tbody>

<tbody>
</tbody>

Worksheet Formulas
CellFormula
B2=IFERROR(VLOOKUP(A2,C:D,2,0),-9999)

<tbody>
</tbody>

<tbody>
</tbody>






hi, i try to usi that formula but when i run with these data i dont get matching values eg.: i am using = IFERROR(VLOOKUP(A2,C$2:D$20,2,0),-9999)

A B C D
01/01/2011 00:00001/01/2011 00:000
01/01/2011 01:00001/01/2011 01:000
01/01/2011 02:00-999901/01/2011 02:000
01/01/2011 03:00001/01/2011 03:000
01/01/2011 04:00001/01/2011 04:000
01/01/2011 05:00-999901/01/2011 05:000
01/01/2011 06:00001/01/2011 06:000
01/01/2011 07:00001/01/2011 07:000
01/01/2011 08:00-999901/01/2011 08:000
01/01/2011 09:00001/01/2011 09:000
01/01/2011 10:00001/01/2011 10:000
01/01/2011 11:00-999901/01/2011 11:000
01/01/2011 12:00001/01/2011 12:000
01/01/2011 13:00001/01/2011 13:000
01/01/2011 14:00-999901/01/2011 14:000
01/01/2011 15:00001/01/2011 15:000
01/01/2011 16:00001/01/2011 16:000
01/01/2011 17:00-999901/01/2011 18:000
01/01/2011 18:00001/01/2011 21:000
01/01/2011 19:00-9999
01/01/2011 20:00-9999
01/01/2011 21:000

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>



thanks
 
Upvote 0
What is the value in cell A2 as seen in the formula bar?
What is the value in column C as seen in the formula bar that is suppose to match A2?

You can easily test if two values truly match with something like
=A2=C10
This will return TRUE or FALSE if they match or not.
 
Upvote 0

Forum statistics

Threads
1,215,517
Messages
6,125,287
Members
449,218
Latest member
Excel Master

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