#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default SUMIFS with Trim

On a sheet called Report I have a column of account codes going down
the page. There are no spaces in these codes, they are alpha numeric.

On this Report sheet I have a SUMIFS formula that says
SUMIFS(Transactions!$E:$E,Transactions!$H:$H,$F20, Transactions!$Q:
$Q,Report!R$8)

On a sheet called Transaction is a list of transactions, along with
account code for each line (transaction) in column H. The account
codes in H have trailing spaces.

Using the account code on the Report sheet, I am trying to find
corresponding transactions posted to that account number in the sheet
called Transactions - but teh trailing spaces are causing problems.

To eliminate the effect of the trailing spaces I would like to enter
=SUMIFS(Transactions!$E:$E,Trim(Transactions!$H:$H ),$F20,Transactions!
$Q:$Q,Report!R$8)

but this reports an error. Does this need to be an array?.

Is there another way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default SUMIFS with Trim

On Jun 5, 8:59*pm, GavinS wrote:
To eliminate the effect of the trailing spaces I would like
to enter
=SUMIFS(Transactions!$E:$E,Trim(Transactions!$H:$H ),$F20,
Transactions!$Q:$Q,Report!R$8)
but this reports an error. Does this need to be an array?


No, that does not make it work.

GavinS wrote:
Is there another way to do this?


One sloppy way that might suffice:

=SUMIFS(Transactions!$E:$E,Transactions!$H:$H,$F20 &"*",
Transactions!$Q:$Q,Report!R$8)

I say this is "sloppy" because F20&"*" will not only match H:H values
with trailing blanks, but also H:H that might be very different after
the first LEN(F20) characters. For example, if F20 is "A12345",
F20&"*" would match "A123456".

Only you can decide if that is or is not a possibility with your data.

If that is unsatisfactory for that reason, you might try using
SUMPRODUCT. For example:

=SUMPRODUCT((TRIM(Transactions!$H:$H)=$F20)
*(Transactions!$Q:$Q=Report!R$8),Transactions!$E:$ E)

Caveat: Since XL2003 SUMPRODUCT does not accept ranges of the form
H:H, Q:Q and E:E, I am unable to test this to be sure that TRIM(H:H)
works as well. In any case, it would be prudent to use finite ranges
such as H1:H1000,Q1:Q1000 and E1:E1000. That form is probably more
efficient anyway.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default SUMIFS with Trim

Yep, that approach
=SUMPRODUCT((TRIM(Transactions!$H:$H)=$F20)*(Trans actions!$Q:
$Q=Report!R$8),Transactions!$E:$E)
works.

Thanks


On Jun 6, 1:41*pm, joeu2004 wrote:
On Jun 5, 8:59*pm, GavinS wrote:

To eliminate the effect of the trailing spaces I would like
to enter
=SUMIFS(Transactions!$E:$E,Trim(Transactions!$H:$H ),$F20,
Transactions!$Q:$Q,Report!R$8)
but this reports an error. Does this need to be an array?


No, that does not make it work.

GavinS wrote:
Is there another way to do this?


One sloppy way that might suffice:

=SUMIFS(Transactions!$E:$E,Transactions!$H:$H,$F20 &"*",
Transactions!$Q:$Q,Report!R$8)

I say this is "sloppy" because F20&"*" will not only match H:H values
with trailing blanks, but also H:H that might be very different after
the first LEN(F20) characters. *For example, if F20 is "A12345",
F20&"*" would match "A123456".

Only you can decide if that is or is not a possibility with your data.

If that is unsatisfactory for that reason, you might try using
SUMPRODUCT. *For example:

=SUMPRODUCT((TRIM(Transactions!$H:$H)=$F20)
*(Transactions!$Q:$Q=Report!R$8),Transactions!$E:$ E)

Caveat: *Since XL2003 SUMPRODUCT does not accept ranges of the form
H:H, Q:Q and E:E, I am unable to test this to be sure that TRIM(H:H)
works as well. *In any case, it would be prudent to use finite ranges
such as H1:H1000,Q1:Q1000 and E1:E1000. *That form is probably more
efficient anyway.


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
TRIM Help ! Nikki Excel Discussion (Misc queries) 8 April 22nd 09 06:20 PM
TRIM Q Seanie Excel Worksheet Functions 3 November 17th 08 08:50 AM
=TRIM Shayra Excel Discussion (Misc queries) 5 October 16th 08 07:16 PM
Trim and Mid with VBA Jeff Excel Discussion (Misc queries) 1 April 19th 06 05:24 PM
Trim help please Dave New Users to Excel 8 September 1st 05 07:18 PM


All times are GMT +1. The time now is 12:10 AM.

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

About Us

"It's about Microsoft Excel"