Avatar of activematx
activematx
Flag for United States of America asked on

Easy Excel - Show Variance Between two column sets

Hi Experts,

I have attached a workbook of the example I am scratching my head at.  See screenshot:
 Example (Excel File)
I have two columns with data in them.  I need to calculate the variance between the two sets of data.  For example, the first row would be variance of 1 since 2-1=1

Thank you for your help. Example.xlsx
Microsoft ExcelSpreadsheets

Avatar of undefined
Last Comment
dlmille

8/22/2022 - Mon
JP

Place this formula in I3 and then copy it down the rest of the range.

=IF(ISNA(MAX(IF(ISNA(VLOOKUP(H3,B$3:C$13,2,FALSE)=TRUE),0,VLOOKUP(H3,B$3:C$13,2,FALSE)),IF(ISNA(VLOOKUP(H3,E$3:F$12,2,FALSE)=TRUE),0,VLOOKUP(H3,E$3:F$12,2,FALSE))))=TRUE,0,MAX(IF(ISNA(VLOOKUP(H3,B$3:C$13,2,FALSE)=TRUE),0,VLOOKUP(H3,B$3:C$13,2,FALSE)),IF(ISNA(VLOOKUP(H3,E$3:F$12,2,FALSE)=TRUE),0,VLOOKUP(H3,E$3:F$12,2,FALSE)))-MIN(IF(ISNA(VLOOKUP(H3,B$3:C$13,2,FALSE)=TRUE),0,VLOOKUP(H3,B$3:C$13,2,FALSE)),IF(ISNA(VLOOKUP(H3,E$3:F$12,2,FALSE)=TRUE),0,VLOOKUP(H3,E$3:F$12,2,FALSE))))
activematx

ASKER
Wow, Peetjh that is some formula!  It works great.   Hmm... could you briefly explain this to me...
Is this formula written by hand, or auto-generated within excel?
  I am just trying to learn more.  Is this the best way to achieve this?  Thanks!
ASKER CERTIFIED SOLUTION
JP

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
activematx

ASKER
Peetjh is truly an asset to this community.  Wonderful work here, and good explanation.  A++++
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Patrick Matthews

That is vastly overdoing it.  This should work rather well:

In I3:

=SUMIF(B:B,H3,C:C)-SUMIF(E:E,H3,F:F)

For absolute variance:

=ABS(SUMIF(B:B,H3,C:C)-SUMIF(E:E,H3,F:F))

Copy down as needed.
JP

Thanks Patrick, as I was working on it I knew there had to be an easier way that I was overlooking.
dlmille

Following your logic of subtracting the QTY in F from QTY in C, then we can use SUMIF to find the values.  Put this in I3 and copy down:

=SUMIF(E:E,H3,F:F)-SUMIF(B:B,H3,C:C)

Of course, the ranges could be tightned, for speed, if needed - e.g., E:E would be E2:E12, etc...


see attached:

Dave
Example.xlsx
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
dlmille

Apologies - my IE didn't update and I didn't realize the question had already been answered.

lol

Dave