• Resolved prodograw

    (@prodograw)


    Hi what am i doing wrong here please??

    $objPHPExcel->getActiveSheet()->setCellValue("F$row", "B$row*C$row" );

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author algol.plus

    (@algolplus)

    missed = ?

    $objPHPExcel->getActiveSheet()->setCellValue("F$row", "=B$row*C$row" );

    Thread Starter prodograw

    (@prodograw)

    i keep getting blank pop up notifcation error for the php error

    Thread Starter prodograw

    (@prodograw)

    ah hold on i have $row set as:

    $row = $formatter->last_row;

    how do i get current row

    • This reply was modified 6 years, 1 month ago by prodograw.
    Plugin Author algol.plus

    (@algolplus)

    please, paste all function/hook code

    Thread Starter prodograw

    (@prodograw)

    at present i am calculating TOTAL KG which is fine

     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E1", "Total KG:" );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E2", "=SUMPRODUCT(B2:B$row,C2:C$row)");

    but as i go along i will be breaking it down to each product and seperating products by total weight so we can see how much we need to produce per product to get through the month

    so i need one column to multiply weight (colB) * quantity (colC)

    once i achieve that i can carry on with SUMPRODUCT and build the xls i need

    // sum Excel column
    add_action( 'woe_xls_print_footer', function ($objXls,$formatter) {
    
     $row = $formatter->last_row;
     // edit column names below! 
     $formatter->$objPHPExcel->getActiveSheet()->setCellValue("D$row", "=B$row*C$row" );
     $formatter->objPHPExcel->getActiveSheet()->getStyle( "E1" )->getFont()->setBold( true );
     $formatter->objPHPExcel->getActiveSheet()->getStyle( "E2" )->getFont()->setBold( true );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E1", "Total KG:" );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E2", "=SUMPRODUCT(B2:B$row,C2:C$row)");
    } ,10, 2); 
    Thread Starter prodograw

    (@prodograw)

    testing in excel directly works with below :

    if cell has 9810:
    =SUMPRODUCT(--(A2:A7=9810),B2:B7,C2:C7)

    but does work in plugin and get error:

    // sum Excel column
    add_action( 'woe_xls_print_footer', function ($objXls,$formatter) {
    
     $last_row = $formatter->last_row;
     // edit column names below! 
     $formatter->$objPHPExcel->getActiveSheet()->setCellValue( "D2","=SUMPRODUCT(--(A2:A$last_row=9810),B2:B$last_row,C2:C$last_row)");
     $formatter->objPHPExcel->getActiveSheet()->getStyle( "E1" )->getFont()->setBold( true );
     $formatter->objPHPExcel->getActiveSheet()->getStyle( "E2" )->getFont()->setBold( true );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E1", "Total KG:" );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "E2", "=SUMPRODUCT(B2:B$last_row ,C2:C$last_row )");
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "F1", "Meal" );
     $formatter->objPHPExcel->getActiveSheet()->setCellValue( "F2",  "rrr");
    } ,10, 2);   
    Thread Starter prodograw

    (@prodograw)

    found the issue grrrr was simple $:

    had:
    $formatter->$objPHPExcel->

    supposed to be:
    $formatter->objPHPExcel->

    thanks for your help

    Plugin Author algol.plus

    (@algolplus)

    good news.

    we’ve got a lot of tickets today.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Multiply One Cell By Another’ is closed to new replies.