Support » Plugin: Advanced Order Export For WooCommerce » Multiply One Cell By Another

  • 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" );

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

    ah hold on i have $row set as:

    $row = $formatter->last_row;

    how do i get current row

    • This reply was modified 2 months, 1 week ago by prodograw.
    Plugin Author algol.plus

    (@algolplus)

    please, paste all function/hook code

    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); 

    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);   

    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)
  • You must be logged in to reply to this topic.