PC Review


Reply
Thread Tools Rate Thread

Converting Excel Equation into VBA

 
 
CFitz
Guest
Posts: n/a
 
      9th May 2008
I currently have a spreadsheet that starts up with a series of userforms.
Within these userforms an employee will select certain criteria to base
equations on. I've built all of the dialog boxes and everything works great.
The issue I'm having now is that when the employee hits the final command
button I want an equation to populate. The current example is very simple
and only has one requirement. I originally wrote the equation in excel to
first demonstrate that using several SUMIFS we could accomplish what we
needed. I was then told that there could be many different criteria and I
would prefer to have excel only calculate one equation instead of many if
they only needed one at a time. Below is the current excel equation.

=((SUMIFS('recovery idea.xlsm'!PAID2003,'recovery
idea.xlsm'!DAYS2003,">="&$A2,'recovery idea.xlsm'!DAYS2003,"<="&$B2,'recovery
idea.xlsm'!DTEOFPAY2003,"<="&'recovery idea.xlsm'!MAXDATE))+(SUMIFS('recovery
idea.xlsm'!PAID2007,'recovery idea.xlsm'!DAYS2007,">"&$A2,'recovery
idea.xlsm'!DAYS2007,"<="&$B2,'recovery
idea.xlsm'!DTEOFPAY2007,"<="&MAXDATE)))/(SUMIF(REFERREDDTE,"<"&MAXDATE-RecoveryRates!$A2,BALREFERRED))

A2 currently equals 0 and B2 equals 30. A3 would equal 31 and B3 60... so
on and so forth. The first two SUMIFS gather amounts that meet the criteria
(in this case any payment made prior to the MAXDATE, the max date is being
pulled from the last dialog box). The third SUMIF divides the total by the
amount that was referred. Basically showing the amount collected over the
total possible.

Below is the current code for when the command button is hit.

Private Sub CommandButton2_Click()
Sheet4.Cells(2, "H") = TextBox1.Value
Unload AllLegalNone
End Sub

Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert Math type equation 5 to word 2007 equation =?Utf-8?B?ZmJyaW9s?= Microsoft Word Document Management 6 12th Sep 2006 10:08 PM
Equation Editor - Word 2003 - Equation alignment =?Utf-8?B?aGVpbmFsZW0=?= Microsoft Word Document Management 1 25th Aug 2006 12:48 PM
Math involved. Excel speed optimization question. UDF vs. longer excel equation Abe Microsoft Excel Programming 6 5th Jul 2006 03:17 PM
~Help~ converting Excel equation to vba function Ambrosia Microsoft Excel Programming 1 1st Nov 2005 12:09 AM
Re: Equation Editor 3.0, Converting from Mac to PC Bob Mathews Microsoft Word Document Management 0 24th Apr 2004 07:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:45 AM.