SumIF in multiple columns in VB

davidhall80

Well-known Member
Joined
Jul 8, 2006
Messages
663
I get a data dump in columns A to Q. I want to do a SUMIF but the data is spread across multiple columns. for example....where ever there is the word "Computer" or "Phone"......to the right cell of "Computer" or "Phone" ....there is a numerical value. Is it possible for me to add all these values together since they are in different columns. I would like an input box to pop up. In the input box, I would enter the word "Computer" or whatever reference I need and then I would get the sum of all of the values to the right cell of that word in columns A to Q. Is this possible.

example

..........A.............B..........C..........D..........E..........F..........G
1...Computer....$10.............................Phone $35

2.....Phone........$35

3..............................Computer....$25

4

5

6.....................................................Computer....$50

7



I would like the Input box to pop up, then I'd put Computer....and than another input box would return the value $85 (50+25+10)
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

why VB

=SUMPRODUCT(--($A$1:$Q$20=S1),OFFSET($A$1:$Q$20,0,1))

where S1 = computer
 

Forum statistics

Threads
1,141,681
Messages
5,707,796
Members
421,529
Latest member
Balintn

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
Top