Excel function needed

Copper Contributor

Excel novice here... I am in need of a function to give me the following outcome.

 

If the value in column A is the same then add the values in column B.

 

All help is appreciated!

 

Thank you,

 

Joni 

7 Replies

@Joni_B You write "If the value in column A is the same....". The same as what, I wonder. If you have a workbook that shows what you are trying to do, you can perhaps upload it. 

@Joni_B 

 

You wrote: If the value in column A is the same...    Same as what??

...then add the values in column B.    Value (singular) in Column A, values (plural) in Column B: is that really what you mean? If so, please give example of what that might look like, along with what some other situations where the conditions might not be met.

 

A big--major--part of creating a functional spreadsheet is real clarity in expressing in words what it is that is to be done. Computers are very precise, and they'll do precisely what you instruct them to do, even if it turns out not to be what you meant them to do. That's why occasionally we read stories in the news of major financial institutions making major blunders based on spreadsheet projections of this that or the other.

 

Hence my suggestion that you need to define what you need a bit more clearly. Once you've done that, we can happily and confidently offer some help.

I have just uploaded a spreadsheet. The function I need is.

On the "reg invoices" tab. If the value in column D is the same then add the value in column I.

The values in column D are orders numbers. I need the total value associated with each order number.
I hope this makes more sense.
THANK YOU!

@Joni_B What you ask for is possible with a Pivot Table, I believe. Added a worksheet "Sheet1" with such a table. Is that what you hand in mind?

More about pivot tables in the attached link.

https://support.microsoft.com/en-us/office/create-a-pivottable-to-analyze-worksheet-data-a9a84538-bf... 

Yes! This is what I need! I have never used pivot tables. Will the link you provided be able to walk me through this?

@Joni_B 

It does make more sense...and I've created a solution. It may or may not be the best solution. It also depends on one relatively new function...UNIQUE...which requires the most recent versions of Excel.

 

Basically I created a new sheet in your workbook, called "Dashboard," and entered two formulas. The first is this:

=UNIQUE('reg invoices'!D1:D1926)

That function is in Cell C3 of the Dashboard; this function generates a complete list of all the unique invoice numbers, whether they appear just once or appear 100s of times

 

Then, in the adjacent column, I entered:

=SUMIF('reg invoices'!$D$1:$D$1926,Dashboard!C3,'reg invoices'!$I$1:$I$1926)

and copied it down to all the rows that had an invoice number in them. This gets the total associated with each invoice number.

 

I see that @Riny_van_Eekelen has just given you another solution, equally functional (and, importantly, not relying on the new function UNIQUE. The Pivot Table solution is a good one as well.  One of the great aspects of Excel--which you're experiencing here--is that there are often two or more ways, quite distinctive, to accomplish the same result.

 

@Joni_B The link has it all. And there are many other resources on-line with videos tutorials etc. Just search for "pivot table excel".