Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

WriteExcel AVERAGE containing variable as end Range

Posted on 2004-09-14
1
180 Views
Last Modified: 2013-12-25
I have a perl program that uses Spreadsheet::WriteExcel.   I am using the AVERAGE and SUM functionality in the following manner:
      $worksheet->write('D'.$nplay, '=AVERAGE(D2:D26)',$average);
      $worksheet->write('E'.$nplay, '=AVERAGE(E2:D26)',$onezero);
      $worksheet->write('K'.$nplay, '=SUM(K2:K26)',$currency);
      $worksheet->write('O'.$nplay, '=SUM(O2:O26)',$currency);

This works fine most of the time but the problem is that the end of the range can change on occasion.  I need to be able to replace the "26" in each of the above examples with a variable.  I have tried the following and it does not seem to be correct syntax:
my $avg1="D".$avg;       
$worksheet->write('D'.$nplay, '=AVERAGE(D2:"$avg1")',$average);

any help here would be greatly appreciated.  
0
Comment
Question by:spoma
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 12061462
$worksheet->write('D'.$nplay, "=AVERAGE(D2:$avg1)",$average);
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question