Need Help With IF Functions with Greator Than and Less than signs

nbeb1215

New Member
Joined
Jan 13, 2024
Messages
1
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Im having trouble writing a If statement. The problem is to write a statement that determines whether the infant is greater or less in weight than the overall average, and assign a 1 to those greater and a 0 to those less.
Ive tried a few things but i am struggling to get it to cooperate
 

Attachments

  • Screenshot (47).png
    Screenshot (47).png
    189.4 KB · Views: 15

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
No idea where you want the result to go, but if column A is the infant weights then you want this starting in row 2 then copy down.

Excel Formula:
=IF(A2<$D$4,0,1)

This will assign a 1 to weight greater than or equal to the average.
 
Upvote 0
=--(A2>=D$4)
Hi Peter,

I've never see this (--) before... that I can recall. Is there an official name for this?

I found some calling it a:
  • double negative
  • double minus sign
  • double dash, etc.
but no one sited the source to it's meaning.

One site offered a simple description which makes perfect since with your use case:
1705195237174.png

However, I'm curious as to the official name...

Thanks
 
Upvote 0
There is not an "official" name, it's just a unary minus followed by another unary minus. I suppose people might make up pet names for it, but there is nothing official.

The inner (second) unary minus forces the Boolean expression to be converted to a number, but TRUE would be converted to -1. The outer (first) unary minus switches it back to positive.
 
Upvote 0
I know it as a double unary.
See if this helps at all:

Any arithmetic operation applied to True/False will work eg
+0 or *1 will do the same thing. It just seems to be common practice to use "--"
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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