Check columns match across adjacent cells.

msohare91

New Member
Joined
Jun 8, 2020
Messages
17
Office Version
  1. 2016
Hi all,

Have some code I'm struggling with. Basically I have prices/values in column M. There will be a number of different prices in the column but for every row that has price X in column M, I need all cells in the same row of Column K to have the same text (these will be months written in general format) as each other and all cells again in the same row of Column I to net to zero - for column i I already have the positive and negative values using another bit of code so it will be a simple sum all line to make sure the net value is 0.

Essentially overall I need it code that checks below are all matching with IF function and moves on once matching. So for example, I want the code to go to column M and check for X (e.g 45) and if the the contract months in the adjacent rows in Column K are both matching with price X then it moves to Column I and checks the buy/sells for that contract and that price all net to 0. Normally these will match on my check but I need a loop whereby it checks price X has same contracts and net flat on buys/sells then if ok moves to price Y etc until all done. The tricky part is that prices can also be out so if for example one of the 45 prices was 47 in error I want the code to stop the loop and notice that buys/sells are flat, contracts match but a price is out. So essentially any of the 3 economics can be wrong. I simply need a check error message for any one of the possible faults if one is out (which I can do), I do not need any correction in the code. I have already removed extra text from the price column to leave only values and have made the sells negative so that I can sum to zero but am stuck with how to check all the 3 columns against each other. Any help much appreciated.

Buy/Sell Contract Price

10 Nov 20 45
-10 Nov 20 45
20 Dec 20 50
-20 Dec 20 50
30 Jan 21 55
-30 Jan 21 55
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Watch MrExcel Video

Forum statistics

Threads
1,129,373
Messages
5,635,884
Members
416,886
Latest member
coreyalaurence37

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
Top