PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 5, 2022

[FIXED] How to apply formula in excel through phpexcel by iterate each column?

 October 05, 2022     php, phpexcel     No comments   

Issue

i want to iterate through each column and apply formula.

for example:

'I'.$ab = ('H'.$ab*100)/A34;

I want to apply formula like above in I column where $ab is row number.

So how can i do it.

Thanks


Solution

It's absolutely basic PHP, just a simple iteration, and some string concatenation

for ($ab = 2; $ab <= 10; ++$ab) {
    $objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('I'.$ab, '=(H'.$ab.'*100)/A34');
}


Answered By - Mark Baker
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing