Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WriteExcel AVERAGE containing variable as end Range

Posted on 2004-09-14
1
Medium Priority
?
185 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
[X]
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
1 Comment
 
LVL 84

Accepted Solution

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

593 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