Question about Microsoft Excel for PC

# Sumproduct or conditional sumif with multiple criteria in vba code...

Can anyone of you excel vba wiz and gurus tell me what's wrong with this code, I keep getting a Run-Time error '13': Type Mismatch error with this code.

Private Sub CommandButton1_Click()

Sheets("summary").Range("g74").Activate

Dim i As Integer
i = 74
For i = 74 To 80

ActiveCell.Offset(0, 1).Value = WorksheetFunction. _
SumProduct(--Sheets("stock card").Range("a2:a3351").Value = Sheets("summary").Range("a" & i).Value, _
--Sheets("stock card").Range("b2:b3351").Value = "", _
--Sheets("stock card").Range("e2:e3351").Value >= Sheets("summary").Range("\$g\$84").Value, _
Sheets("stock card").Range("k2:k3351").Value)

ActiveCell.Offset(1, 0).Activate

Next i
End Sub

Also, I would like to be able to use the "conditional sumif" function using multiple criteria arrays in lieu of the above "sumproduct" function...is this possible???

Thanks in advance, any help is most appreciated...
Jay

Posted by on

• Level 1:

An expert who has achieved level 1.

Hot-Shot:

An expert who has answered 20 questions.

Corporal:

An expert that hasĀ over 10 points.

Mayor:

An expert whose answer gotĀ voted for 2 times.

• Contributor

yes, you can do multiple criteria query but with a matrix formula. you may look it up. nonetheless, here is how one would look like:

{=sum(if(range1=A x range2=B x range3=C, sum range))} note that x (multiplication) is used to denote intersection of the criteria

initially, you'll enter it as:
=sum(if(range1=A x range2=B x range3=C, sum range))

then, edit the cell (F2) and press ctrl+shift+enter for the brackets { } to appear.

Posted on Nov 18, 2008

Hi,
a 6ya Technician can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repair professionals here in the US.
Goodluck!

Posted on Jan 02, 2017

×

my-video-file.mp4

×

## Related Questions:

Apr 15, 2013 | Computers & Internet

### What is exel sheet extension in office 2010 ?

Excel Workbook

.xlsx

The default Excel file format. Cannot store VBA macro code or Microsoft Excel 4.0 macro sheets (.xlm files in Excel 4.0).

Excel Macro-Enabled Workbook

.xlsm

Uses the same basic XML format as the Excel Workbook, but can store VBA macro code. Users saving an Excel workbook that has VBA code or Excel 4.0 macro sheets (.xlm files in Excel 4.0) are prompted to use this file format.

Excel Template

.xltx

The default file format for an Excel template. Cannot store VBA macro code or Excel 4.0 macro sheets (.xlm files in Excel 4.0).

Excel Macro-Enabled Template

.xltm

Can contain a VBAProject part or Excel 4.0 macro sheets (.xlm files in Excel 4.0). Workbooks created from this template inherit the VBAProject part or Excel 4.0 macro sheets that exist in the template.

.xlam

A supplemental program that runs additional code. Excel add-ins use the Open XML file format to store data, and they support using VBA projects and Excel 4.0 macro sheets.

Feb 21, 2011 | Computers & Internet

### Why do i loose my custom Views in Excell 2003 when I add drop down lists?

Have you tried to save them as a custom worksheet template? See this tip , this one, this tip, and site for other tips related. (For saving custom views of filtering criteria, see here and here.)
Here is the MS article that thoroughly explains the means for using VBA codes to customize your excel 2003 command bars.

I hope this information allows you to resolve this issue. If you need further assistance, please post back with a comment to this thread.
If I've managed to answer your question or solve a problem, please take just a moment to rate this post....thanks!

Aug 26, 2009 | Microsoft Office Excel 2007

### Excel farmulas

Add another colum, say D with result of B*C

Do a list of the different cat, and use sumif
For cat 0101 (in cell F1)
formula to put in G1
=sumif(\$A\$1:\$A\$7000;F1;\$D\$1:\$D\$7000) where F1 contain 0101

expand the formula for other cat. (G2, G3, etc)

You can use a assistant to extract the distinct cat from A1:A7000, sorting them and copy the result in F (Menu Data-> Filter -> elaborate filter)

Feb 16, 2009 | Microsoft Excel for PC

### Need Formula

TEXT CASE
Convert to UPPER, Proper or lower
Auto Convert to UPPER, Proper or lower
Stop VBA Being Case Sensitive

SELECT CASE VBA
Select Case Statement. Great alternative to Else If Statements

CONVERSION
VBA: CBool(),CByt(),CCur(),CDate(),CDbl()Double,CDec(),CInt(),CLng(),CSng(),CStr(),CVar().
Example
dDate=cDate("25-Jan-07")
Convert Numbers to Words
Convert Numbers to Dollar Amount in Words
Spreadsheet Converter. Versions: HTML/JavaScript,Excel ASP.Net and Excel Java/JSP. \$
SQL Database Migration \$
Converters. Database Converters, Spreadsheet Converters, Text Converters, E-mail Conversion, Document Conversion, PDF Conversion and more! \$
CSV Converter \$

IMPORTING
Import SQL Into Excel-SQL Tester \$
Import Excel Into Access \$

CONDITIONAL FORMATTING
Conditional Formatting
More Than 3 Conditional Formats
Conditional Format Fonts for greater than 3

CUSTOM FORMATS
Custom Formats
Excel see a cells format as having four Sections. These are, from left to right: Positives;Negatives;Zeros;Text.

To hide zeros cell-by-cell use a Custom Number Format like 0.00;-0.00; where 0.00 is desired format for non zeros. Note the use of -0.00 for negatives.

To hide zeros on the Workbook level go to Tools>Options>View - Zero Values.

Dec 15, 2008 | Microsoft Windows XP Home Edition

### Excel counting

Aug 12, 2008 | Microsoft Excel for PC

### SUMIF formula

One in general should not use Find & Replace.
I would recommend always creating the first formula manually by selecting the cells. This will avoid common errors like extra spaces.

May 11, 2008 | Microsoft Excel for PC

### Excel formula

Yes, there is a function in MS Excel called "sumproduct" which multiplies the componenets in an array or arrays, then totals the result, eg :

=SUMPRODUCT(D4:D20,B4:B20) ...Job done...Enjoy !

Jan 16, 2008 | Microsoft Excel for PC

You can but you will need software. Search for google for VBA password recovery tools. Search for the appropriate crack you have it all . .

Dec 30, 2007 | Microsoft Excel for PC

### Using if and then to add values to a cell

Try using the SUMIF function for one condition or multiple conditions. Use the SUMIF worksheet function to create a total value for one range based on a value in another range. For example, for every cell in the rage B5:B25 that contains the value "Northwind", the following formula calculates the total for the corresponding cells in the range F5:F25. Formula:
=sumif(B5:B25,"Northwind",F5:F25)

Here are SUMIF functions for multiple conditions.

=sum(if((B5:B25="Northwind")*(C5:C25="Western"),F5:F25))

=sum(if((B5:B25="Northwind")+(C5:C25="Western"),F5:F25))

=sum(if(B5:B25="Northwind",IF(C5:C25="Western"),1,0)))

Also check your help for SUMIF functions.

If this helps you, Please rate me. Thanks, Patty

Dec 09, 2007 | Computers & Internet

#### Related Topics:

3,922 people viewed this question

Level 3 Expert

Level 3 Expert