HOW TO: If value in a row matches another row's value, sum up column value in both rows

yleong

New Member
Joined
Jun 28, 2011
Messages
5
Hi, I am new to Excel and need help with a formula.

I need the formula to sum up the values from the column Bs of rows whose column A info match each other.

A example of this is:


Column A Column B Column C (Formula)
car..............$5
car..............$4
car..............$3.........$12

If this is possible, please let me know :)

Also, I understand if Column C will be

Column C (Formula)
$12
$12
$12

Do let me know if you can help with either situation, although I would prefer that for each set of duplicates in column A, only one value will appear in column C. Thanks in advance! :biggrin:
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, I am new to Excel and need help with a formula.

I need the formula to sum up the values from the column Bs of rows whose column A info match each other.

A example of this is:


Column A Column B Column C (Formula)
car..............$5
car..............$4
car..............$3.........$12

If this is possible, please let me know :)

Also, I understand if Column C will be

Column C (Formula)
$12
$12
$12

Do let me know if you can help with either situation, although I would prefer that for each set of duplicates in column A, only one value will appear in column C. Thanks in advance! :biggrin:
Try this...

Book1
ABC
2Car5_
3Car4_
4Car312
5Bus5_
6Bus510
7Bike77
Sheet1

Formula entered in C2 and copied down:

=IF(A2=A3,"",SUMIF(A$2:A$7,A2,B$2:B$7))
 
Upvote 0
Thanks for your reply, it worked! But I don't quite understand the formula even after trying it out on Excel.

=IF(A2=A3,"",SUMIF(A$2:A$7,A2,B$2:B$7)) <- for this, why is the [value if true] just this ""?

Thanks for taking the time to reply!
 
Upvote 0
Thanks for your reply, it worked!
You're welcome. Thanks for the feedback! :cool:

But I don't quite understand the formula even after trying it out on Excel.

=IF(A2=A3,"",SUMIF(A$2:A$7,A2,B$2:B$7)) <- for this, why is the [value if true] just this ""?

Thanks for taking the time to reply!
We use that test so that the "subtotal" will be placed on the last row for each item.

Like this...

=IF(A2=A3 = TRUE = Leave this cell blank
=IF(A3:A4 = TRUE = Leave this cell blank
=IF(A4=A5 = FALSE = Do the SUMIF for CAR and put the result in this cell
=IF(A5=A6 = TRUE = Leave this cell blank
=IF(A6=A7 = FALSE = Do the SUMIF for BUS and put the result in this cell
=IF(A7=A8 = FALSE = Do the SUMIF for BIKE and put the result in this cell
 
Upvote 0
I see now! But this would mean we will have to sort by column A before doing the summing then, right? Thanks for your assistance it meant a lot ;)
 
Upvote 0
I see now! But this would mean we will have to sort by column A before doing the summing then, right? Thanks for your assistance it meant a lot ;)
Yes, the data would need to be sorted or grouped together for that to work.

I assumed the data was sorted or grouped together and you want the subtotal on the last row for each item based on this exhibit in your post:

Column A Column B Column C (Formula)
car..............$5
car..............$4
car..............$3.........$12
 
Upvote 0
In the event that you are not allowed to sort the list you can created a sorted list on the side as shown, just an alternative, may not be the way you asked for , I just post this for info if interested.

Excel Workbook
ABCDEF
1ItemsSome numberUnique ListTotals
2Car27Boat14
3Car15Car80
4Boat14Home29
5Motorcycle25Motorcycle167
6Car28RV
7Motorcycle48
8Motorcycle36
9RV22
10Car10
11Motorcycle13
12RV12
13Motorcycle22
14RV33
15Home29
16RV33
17Motorcycle23
Sheet3
 
Upvote 0
Couldn't you get the same "unique list" simply by doing an advanced filter instead of an array formula?
 
Upvote 0
Sure can but if you assign the name to the range then you will see the convinient of doing this way, as it becomes dynamics and the list gets updated upon change . no need to regenerate the procedure for advanced filter. I like things to be dynamic rather than static.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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