Condition required for difference

Cenin

New Member
Joined
Jan 30, 2023
Messages
23
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
1675074085415.png

Hi, From this data, I would like to get the difference between columns 42437-42257 in accordance with the Gender Male or Female and show whether it is male or female is higher.
 

Attachments

  • 1675073737472.png
    1675073737472.png
    5.1 KB · Views: 7
  • 1675073822529.png
    1675073822529.png
    5.5 KB · Views: 6
  • 1675074010374.png
    1675074010374.png
    3.4 KB · Views: 7

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Welcome to the MrExcel board!

For the future, please consider this:
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Is this what you want?

23 01 30.xlsm
ABCD
1DiffWho
2Female42437180Female
3Male42257
Compare
Cell Formulas
RangeFormula
C2C2=ABS(B2-B3)
D2D2=IF(B2>B3,A2,IF(B3>B2,A3,"Equal"))
 
Upvote 0
Thanks for the reply, sir.
Could you please take a look at this? In PC 47 I have 1 male and 5 female employees and I have averaged on gender on column D, and I need to see the differences of Males Vs Females in each cell and have to see who got higher in column F.
France Exec Gender Gap Analysis.xlsx
ABCDEF
1CountGenderPCAverage on PC, Male & Female.Differencewho
25F4742437
35F4742437
45F4742437
51M4742257
65F4742437
75F4742437
85M4945277
91F4945495
105M4945277
115M4945277
125M4945277
135M4945277
calc
Cell Formulas
RangeFormula
A2:A13A2=COUNTIFS($C$2:$C$13,C2,$B$2:$B$13,B2)
 
Upvote 0
Just to be clear, could you please manually fill in the expected results and post the XL2BB sheet again?
 
Upvote 0
PFA
France Exec Gender Gap Analysis.xlsx
ABCDEF
1CountGenderPCAverage on PC, Male & Female.Differencewho
25F4742437180F
35F4742437180F
45F4742437180F
51M4742257-180F
65F4742437180F
75F4742437180F
85M4945277-218M
91F4945495218M
105M4945277-218M
115M4945277-218M
125M4945277-218M
135M4945277-218M
calc
Cell Formulas
RangeFormula
A2:A13A2=COUNTIFS($C$2:$C$13,C2,$B$2:$B$13,B2)
 
Upvote 0
Thanks for the extra info.
Why are F8:F13 = M when cell D9 (Female) is greater than the Male values for PC 49?
 
Upvote 0
I'm extremely sorry sir. It was my mistake, yes you're right, it should be Female as well
 
Upvote 0
What about this then?

BTW, is it possible that M & F values for a PC could be exactly equal? If so, what should happen in column F?

23 01 30.xlsm
ABCDEF
1CountGenderPCAverage on PC, Male & Female.Differencewho
25F4742436.93180.43F
35F4742436.93180.43F
45F4742436.93180.43F
51M4742256.5-180.43F
65F4742436.93180.43F
75F4742436.93180.43F
85M4945276.99647-218.2747794F
91F4945495.27125218.2747794F
105M4945276.99647-218.2747794F
115M4945276.99647-218.2747794F
125M4945276.99647-218.2747794F
135M4945276.99647-218.2747794F
Compare (2)
Cell Formulas
RangeFormula
E2:E13E2=D2-INDEX(FILTER(D$2:D$13,(B$2:B$13=IF(B2="F","M","F"))*(C$2:C$13=C2)),1)
F2:F13F2=IF(E2>0,B2,IF(B2="F","M","F"))
A2:A13A2=COUNTIFS($C$2:$C$13,C2,$B$2:$B$13,B2)
 
Upvote 0
Thanks, sir, and thanks for notifying that. Is it possible to add a condition to that, if both are equal then the value should be "EQUAL"?
 
Upvote 0
Is it possible to add a condition to that, if both are equal then the value should be "EQUAL"?
Sure

23 01 30.xlsm
BCDEF
1GenderPCAverage on PC, Male & Female.Differencewho
2F4742436.93180.43F
3F4742436.93180.43F
4F4742436.93180.43F
5M4742256.5-180.43F
6F4742436.93180.43F
7F4742436.93180.43F
8M4945276.99647-218.2747794F
9F4945495.27125218.2747794F
10M4945276.99647-218.2747794F
11M4945276.99647-218.2747794F
12M4945276.99647-218.2747794F
13M4945276.99647-218.2747794F
14F2012340EQUAL
15F2012340EQUAL
16M2012340EQUAL
Compare (2)
Cell Formulas
RangeFormula
E2:E16E2=D2-INDEX(FILTER(D$2:D$16,(B$2:B$16=IF(B2="F","M","F"))*(C$2:C$16=C2)),1)
F2:F16F2=IF(E2>0,B2,IF(E2=0,"EQUAL",IF(B2="F","M","F")))
 
Upvote 0

Forum statistics

Threads
1,215,140
Messages
6,123,266
Members
449,093
Latest member
Vincent Khandagale

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