PC Review


Reply
Thread Tools Rate Thread

Complex SUMIF

 
 
shaqil
Guest
Posts: n/a
 
      6th Nov 2007
Dear All,

I have data in following form and I want to sum of invoices which have
been written with "," (comma), e.g. 151,153 sum of Rs. 35.

Can any one help me to write this formula.


chq # Inv.# Amount
152 10
151 15
153 20
A 151,153 ?


Thnx in advance.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      6th Nov 2007
How is this request different from your previous request back on Oct 10/11?
and which was answered.

--
Regards,
Tom Ogilvy



"shaqil" wrote:

> Dear All,
>
> I have data in following form and I want to sum of invoices which have
> been written with "," (comma), e.g. 151,153 sum of Rs. 35.
>
> Can any one help me to write this formula.
>
>
> chq # Inv.# Amount
> 152 10
> 151 15
> 153 20
> A 151,153 ?
>
>
> Thnx in advance.
>
>

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      6th Nov 2007
try this code

call with
=suminvoices(A7,B1:B3)

A7 is the string with invoice numbers, B1:B3 is the range of invoices. code
assumes Amount is one cell to the right of the Invoice Number

Function suminvoices(InvoiceString As String, _
ByRef Invoices As Range)

suminvoices = 0
Trim (InvoiceString)
Do While Len(InvoiceString) > 0
If InStr(InvoiceString, ",") > 0 Then
Invoice = Val(Trim(Left(InvoiceString, _
InStr(InvoiceString, ",") - 1)))
InvoiceString = Val(Trim(Mid(InvoiceString, _
InStr(InvoiceString, ",") + 1)))
Else
Invoice = Val(InvoiceString)
InvoiceString = ""
End If
For Each cell In Invoices
If cell = Invoice Then
suminvoices = suminvoices + _
cell.Offset(rowoffset:=0, columnoffset:=1)
End If

Next cell
Loop

End Function


"Tom Ogilvy" wrote:

> How is this request different from your previous request back on Oct 10/11?
> and which was answered.
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "shaqil" wrote:
>
> > Dear All,
> >
> > I have data in following form and I want to sum of invoices which have
> > been written with "," (comma), e.g. 151,153 sum of Rs. 35.
> >
> > Can any one help me to write this formula.
> >
> >
> > chq # Inv.# Amount
> > 152 10
> > 151 15
> > 153 20
> > A 151,153 ?
> >
> >
> > Thnx in advance.
> >
> >

 
Reply With Quote
 
shaqil
Guest
Posts: n/a
 
      8th Nov 2007
On Nov 6, 5:10 pm, Joel <J...@discussions.microsoft.com> wrote:
> try this code
>
> call with
> =suminvoices(A7,B1:B3)
>
> A7 is the string with invoice numbers, B1:B3 is the range of invoices. code
> assumes Amount is one cell to the right of the Invoice Number
>
> Function suminvoices(InvoiceString As String, _
> ByRef Invoices As Range)
>
> suminvoices = 0
> Trim (InvoiceString)
> Do While Len(InvoiceString) > 0
> If InStr(InvoiceString, ",") > 0 Then
> Invoice = Val(Trim(Left(InvoiceString, _
> InStr(InvoiceString, ",") - 1)))
> InvoiceString = Val(Trim(Mid(InvoiceString, _
> InStr(InvoiceString, ",") + 1)))
> Else
> Invoice = Val(InvoiceString)
> InvoiceString = ""
> End If
> For Each cell In Invoices
> If cell = Invoice Then
> suminvoices = suminvoices + _
> cell.Offset(rowoffset:=0, columnoffset:=1)
> End If
>
> Next cell
> Loop
>
> End Function
>
>
>
> "Tom Ogilvy" wrote:
> > How is this request different from your previous request back on Oct 10/11?
> > and which was answered.

>
> > --
> > Regards,
> > Tom Ogilvy

>
> > "shaqil" wrote:

>
> > > Dear All,

>
> > > I have data in following form and I want to sum of invoices which have
> > > been written with "," (comma), e.g. 151,153 sum of Rs. 35.

>
> > > Can any one help me to write this formula.

>
> > > chq # Inv.# Amount
> > > 152 10
> > > 151 15
> > > 153 20
> > > A 151,153 ?

>
> > > Thnx in advance.- Hide quoted text -

>
> - Show quoted text -


It is not giving me desired result of 35. it sums only one invoice and
I need total of both invoices.

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      8th Nov 2007
The macro I posted will give the results you are looking for. A simple
worksheet formula wil not seperate comma seperated data.

"shaqil" wrote:

> On Nov 6, 5:10 pm, Joel <J...@discussions.microsoft.com> wrote:
> > try this code
> >
> > call with
> > =suminvoices(A7,B1:B3)
> >
> > A7 is the string with invoice numbers, B1:B3 is the range of invoices. code
> > assumes Amount is one cell to the right of the Invoice Number
> >
> > Function suminvoices(InvoiceString As String, _
> > ByRef Invoices As Range)
> >
> > suminvoices = 0
> > Trim (InvoiceString)
> > Do While Len(InvoiceString) > 0
> > If InStr(InvoiceString, ",") > 0 Then
> > Invoice = Val(Trim(Left(InvoiceString, _
> > InStr(InvoiceString, ",") - 1)))
> > InvoiceString = Val(Trim(Mid(InvoiceString, _
> > InStr(InvoiceString, ",") + 1)))
> > Else
> > Invoice = Val(InvoiceString)
> > InvoiceString = ""
> > End If
> > For Each cell In Invoices
> > If cell = Invoice Then
> > suminvoices = suminvoices + _
> > cell.Offset(rowoffset:=0, columnoffset:=1)
> > End If
> >
> > Next cell
> > Loop
> >
> > End Function
> >
> >
> >
> > "Tom Ogilvy" wrote:
> > > How is this request different from your previous request back on Oct 10/11?
> > > and which was answered.

> >
> > > --
> > > Regards,
> > > Tom Ogilvy

> >
> > > "shaqil" wrote:

> >
> > > > Dear All,

> >
> > > > I have data in following form and I want to sum of invoices which have
> > > > been written with "," (comma), e.g. 151,153 sum of Rs. 35.

> >
> > > > Can any one help me to write this formula.

> >
> > > > chq # Inv.# Amount
> > > > 152 10
> > > > 151 15
> > > > 153 20
> > > > A 151,153 ?

> >
> > > > Thnx in advance.- Hide quoted text -

> >
> > - Show quoted text -

>
> It is not giving me desired result of 35. it sums only one invoice and
> I need total of both invoices.
>
>

 
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
Complex Sumif El Bee Microsoft Excel Misc 6 13th Mar 2009 09:00 PM
Complex Sumif JPS Microsoft Excel Worksheet Functions 3 10th Sep 2008 10:24 AM
Re: Complex VBA Sumif Lars-Åke Aspelin Microsoft Excel Misc 0 17th May 2008 05:36 PM
RE: Complex VBA Sumif Brad Microsoft Excel Misc 2 17th May 2008 03:11 AM
complex SUMIF shaqil Microsoft Excel Worksheet Functions 3 12th Nov 2007 02:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:18 PM.