Trouble finding Sum of Table Data

needshelp12

New Member
Joined
Jun 24, 2011
Messages
14
Im using excel 2010 VBA

The data im trying to use is in this format

ID Date Description Debit
1 3/2/2000 Popeyes Ny 5.23
2
..

I created a user form to search the data.
In textbox1 i want to be able to enter "Popeyes"
Hit searchcommandbutton and it Find all Descriptions matching the first
part of what i entered and return the sum the debits (one column to the right) of those numbers in textbox2.

The range of the Descriptions is C10:C200
The range of the debits is D10:D200

Been working at trying to get this to work all day. If anyone could help me , much appreciated.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Code:
Private Sub CommandButton1_Click()
    txt = "*" & TextBox1.Value & "*" ' asterisks allow entry of partial data
    s = Application.WorksheetFunction.SumIf(Range("C10:C100"), txt, Range("D10:D100"))
    TextBox2.Value = Format(s, "###,###.00")
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top