Multiply One Cell By Another
-
Hi what am i doing wrong here please??
$objPHPExcel->getActiveSheet()->setCellValue("F$row", "B$row*C$row" );
-
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 6 years, 1 month ago by
prodograw.
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
good news.
we’ve got a lot of tickets today.
-
This reply was modified 6 years, 1 month ago by
The topic ‘Multiply One Cell By Another’ is closed to new replies.