Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional Calculation


hi there,

I need to code some VBA that will analyse the contents of a strin
field.
If it meets a certain requirement, then I need to multiply a numeri
value that exists in another column on the same row.

e.g. (simplified view)

Project_Group Actuals Likelihood
Committed 112 1.00
Very Likely 98 0.85
Prospects 101 0.45


I need to search the entire range.
any rows that have "prospects" in Column A, I need to multiply th
Actuals figure by the likelihood.


In reality I have 12 columns of Actuals (one for each month), whic
will all need multiplying by the likelihood figure.


Please can someone show me how to do this,
thanks in advance.
Mat

--
matp
-----------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=48867

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Conditional Calculation

Hi Mattpj,

Are the 12 monthly Actuals columns contiguous and does a given liklihood
factor apply to all Actuals columns? Are the existing Actuals to be
replaced?


---
Regards,
Norman


"matpj" wrote in
message ...

hi there,

I need to code some VBA that will analyse the contents of a string
field.
If it meets a certain requirement, then I need to multiply a numeric
value that exists in another column on the same row.

e.g. (simplified view)

Project_Group Actuals Likelihood
Committed 112 1.00
Very Likely 98 0.85
Prospects 101 0.45


I need to search the entire range.
any rows that have "prospects" in Column A, I need to multiply the
Actuals figure by the likelihood.


In reality I have 12 columns of Actuals (one for each month), which
will all need multiplying by the likelihood figure.


Please can someone show me how to do this,
thanks in advance.
Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile:
http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=488678



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional Calculation


Hi Norman,

the actuals start in column T and go until Column AE.
THe values should be replaced by a value equal to the existing value
mulitplied by the value in column O.

but ONLY on rows where column E contains either "Prospects" or
"Unplanned Prospects"

does that make sense?

the code basically needs to scan each row, and when it finds either
value in Column E, then perform the calculation...

thanks for any help,

Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=488678

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Conditional Calculation

Hi Matt,

Try:

'================
Sub TestIt()
Dim rng As Range, rng2 As Range
Dim rcell As Range
Dim aCell As Range
Dim LRow As Long
Dim rngPlanned As Range
Dim CalcMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

LRow = Cells(Rows.Count, "E").End(xlUp).Row

Set rng = Range("E2:E" & LRow) '<<==== CHANGE

For Each rcell In rng.Cells
With rcell
If LCase(.Value) = "planned pospects" _
Or LCase(.Value) = "unplanned prospects" Then
Set rng2 = .Offset(0, 15).Resize(1, 12)
rcell.Offset(0, 10).Copy
rng2.PasteSpecial Paste:=xlValues, _
Operation:=xlMultiply, _
SkipBlanks:=False, _
Transpose:=False
End If
End With
Next rcell

With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================



---
Regards,
Norman



"matpj" wrote in
message ...

Hi Norman,

the actuals start in column T and go until Column AE.
THe values should be replaced by a value equal to the existing value
mulitplied by the value in column O.

but ONLY on rows where column E contains either "Prospects" or
"Unplanned Prospects"

does that make sense?

the code basically needs to scan each row, and when it finds either
value in Column E, then perform the calculation...

thanks for any help,

Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile:
http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=488678



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Calculation René Excel Discussion (Misc queries) 4 August 4th 09 12:37 AM
Conditional calculation? [email protected] Excel Worksheet Functions 3 January 24th 06 09:01 AM
Conditional Calculation bhofsetz Excel Worksheet Functions 3 July 6th 05 04:04 PM
Calculation conditional on yes no Martin Smith Excel Worksheet Functions 6 May 26th 05 04:46 PM
Help, Multiple conditional calculation wwj New Users to Excel 4 March 10th 05 09:05 PM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"