Conditional IF statements for merging multiple datasets

snban1

New Member
Joined
Feb 22, 2018
Messages
1
I am trying to join two datasets (csv format) by using conditional if statements. First dataset is accident information which does have a unique id (caseno) and the second dataset is roadway information which does not have a unique id. To join the accident file to the road file, I have to match multiple columns, if county in dataset 1 equals county in dataset 2 then we match county route (cnty_rte) in dataset 1 to dataset 2. If they are equal, then we match milespost in dataset 1 to a range in dataset 2, beginning of milepost (begmp) to end of milempst (endmp). So, if the milepost falls in this range, the accident would be a perfect match to the road location. My end goal is to have an additional column in dataset 1 which would denote the unique id (caseno) or if there is no match then '0'.
The link for the file is; (www.dropbox.com/s/ytmm3yw10891r4n/stack_Overflow.xlsx?dl=0)

This is the statement which is not working for me
=IF([@county]=nc11acc[@county],IF([@cntyrte]=nc11acc[@[cnty_rte]],IF(nc11acc[@milepost]>=[@begmp],IF(nc11acc[@milepost]<[@endmp],[@OID],0))))

It just gives me values which are False, some 0 values and then some #Values.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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