PDA

View Full Version : Sum adjacent columns based on criteria



skip9999
05-09-2018, 10:35 PM
Good morning all,

I'm new to the forum and a novice when it comes to VBA.

I'm currently tasked with calculating the thickness of material [anything containing RBL (rubble)] in a samples, however the calculation should terminate when the first SST or CNG (sandstone or conglomerate) is encountered. The forumula will the have to loop down the worksheet. An example is attached as a jpeg.

I have ten of thousands of rows to calculate.

Any advice or assistance will be greatly appreciated.
Thanks,
Andy

Tom Jones
05-09-2018, 10:45 PM
Hi,

Cause you attach a picture and we don't know location of cells in need...
Use SUMIF..

skip9999
05-09-2018, 10:59 PM
Hi Tom,

Thanks for your reply. Rather silly of me to attached a picture. Please find attached a xmls example.

I will give SUMIF a go.

Cheers,

Tom Jones
05-10-2018, 03:00 AM
In H13 use:

=SUMIF(G2:G11,"RBL",H2:H11) for Unit_3 and m3