Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 105
Default Problems with Variables

Why would the result for TotalR = 0 (when it should return 226,550.00)
whereas TotalO returns the correct amount.

TotalR = Sheets("Imported Requisition Data").Evaluate("SUMPRODUCT(--(L9:L" &
myRowsR + 8 & "=" & OrderR & "),(G9:G" & myRowsR + 8 & "))")

TotalO = Sheets("JDE Data").Evaluate("SUMPRODUCT(--(B6:B" & myRowsO + 10

I've also noticed that results for other variables related to the ("Imported
Requisition Data") sheet appear as "725", whereas the results from ("JDE
Data") sheet comes through as 725.

I think this is part of the problem, but I've checked that the data in both
sheets is formatted the same way, and now I don't know what else to try.



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Problems with Variables

First thing I see in the first formula is that you're not coercing the second
half of the formula, try replacing
),(G9:G"...
with
),--(G9:G"...
although that really shouldn't affect the results the way you're using this.

As you noted, the format of the imported data appears to be a factor also -
the fact that it's showing up as "725" instead of just 725 indicates it's
stored as text instead of as a numeric value.

Try selecting all of the cells in that have the values shown with " "
surrounding them, and use Edit | Replace and select " as the character to
find and leave the replace with portion empty, click [Replace All]. I think
this is the one that's going to fix the problem.

"Helen" wrote:

Why would the result for TotalR = 0 (when it should return 226,550.00)
whereas TotalO returns the correct amount.

TotalR = Sheets("Imported Requisition Data").Evaluate("SUMPRODUCT(--(L9:L" &
myRowsR + 8 & "=" & OrderR & "),(G9:G" & myRowsR + 8 & "))")

TotalO = Sheets("JDE Data").Evaluate("SUMPRODUCT(--(B6:B" & myRowsO + 10

I've also noticed that results for other variables related to the ("Imported
Requisition Data") sheet appear as "725", whereas the results from ("JDE
Data") sheet comes through as 725.

I think this is part of the problem, but I've checked that the data in both
sheets is formatted the same way, and now I don't know what else to try.



  #3   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Problems with Variables

it is not needed to coerce the second half of the formula, it is not a
logical statement unless it would help the equation recognise the value (I
don't know, but don't believe it does)

I agree it is a text versus number issue

try maybe

TotalR = Sheets("Imported Requisition Data").Evaluate("SUMPRODUCT(--(L9:L" &
myRowsR + 8 & "=" & OrderR & "),Value(Trim(G9:G" & myRowsR + 8 & "))")


"JLatham" wrote:

First thing I see in the first formula is that you're not coercing the second
half of the formula, try replacing
),(G9:G"...
with
),--(G9:G"...
although that really shouldn't affect the results the way you're using this.

As you noted, the format of the imported data appears to be a factor also -
the fact that it's showing up as "725" instead of just 725 indicates it's
stored as text instead of as a numeric value.

Try selecting all of the cells in that have the values shown with " "
surrounding them, and use Edit | Replace and select " as the character to
find and leave the replace with portion empty, click [Replace All]. I think
this is the one that's going to fix the problem.

"Helen" wrote:

Why would the result for TotalR = 0 (when it should return 226,550.00)
whereas TotalO returns the correct amount.

TotalR = Sheets("Imported Requisition Data").Evaluate("SUMPRODUCT(--(L9:L" &
myRowsR + 8 & "=" & OrderR & "),(G9:G" & myRowsR + 8 & "))")

TotalO = Sheets("JDE Data").Evaluate("SUMPRODUCT(--(B6:B" & myRowsO + 10

I've also noticed that results for other variables related to the ("Imported
Requisition Data") sheet appear as "725", whereas the results from ("JDE
Data") sheet comes through as 725.

I think this is part of the problem, but I've checked that the data in both
sheets is formatted the same way, and now I don't know what else to try.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Problems with Variables

If the other suggestions don't help, you may want to develop the formula that
works in that worksheet.

Then share that formula in your followup post.

I was gonna guess that OrderR is a number, but column L is text that looks like
a number.

.... + 8 & "=" & chr(34) & OrderR & chr(34) & ")....

(surround the OrderR in double quotes)

or maybe something like this:

.... + 8 & "=" & chr(34) & format(OrderR, "0000") & chr(34) & ")....

Helen wrote:

Why would the result for TotalR = 0 (when it should return 226,550.00)
whereas TotalO returns the correct amount.

TotalR = Sheets("Imported Requisition Data").Evaluate("SUMPRODUCT(--(L9:L" &
myRowsR + 8 & "=" & OrderR & "),(G9:G" & myRowsR + 8 & "))")

TotalO = Sheets("JDE Data").Evaluate("SUMPRODUCT(--(B6:B" & myRowsO + 10

I've also noticed that results for other variables related to the ("Imported
Requisition Data") sheet appear as "725", whereas the results from ("JDE
Data") sheet comes through as 725.

I think this is part of the problem, but I've checked that the data in both
sheets is formatted the same way, and now I don't know what else to try.


--

Dave Peterson
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
More than 1 Variables [email protected] Excel Discussion (Misc queries) 1 November 29th 06 02:09 AM
Variables in VBA Jeff Excel Discussion (Misc queries) 2 October 17th 06 02:30 PM
Using variables . . . Wayne Knazek Excel Discussion (Misc queries) 2 July 6th 06 05:01 PM
Using variables in a name Vispy Excel Discussion (Misc queries) 4 February 22nd 06 01:17 AM
Two variables Blackcat Excel Discussion (Misc queries) 7 January 7th 05 12:13 PM


All times are GMT +1. The time now is 08:16 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"