# Thread: IF Formula

1. ## IF Formula

Register for a FREE account, and/
or Log in to avoid these ads!

Dear all,

This is driving me crazy, i just want that my formula says e.g. "Underweight" when the value in O2 is below 18.5, "Normal" if the value is between 18.5 and 24.9:

 Underweight = <18.5 Normal weight = 18.5–24.9 Overweight = 25–29.9 Obesity = BMI of 30 or greater Why is this not working : =IF(O2<18.5,"Underweight",IF(18.5<=O2<=24.9,"Normal",IF(25<=O2<=29.9,"Overweight",IF(O2>30,"Obesity")))) Thank you so much for any suggestions!!

2. You’ll need this:

=IF(AND(18.5<=O2,O2<=24.9), ...

or something along those lines.

3. Thank you, but unfortunately it doesnt work.. I think i do something wrong ..

4. Most probably, but it's the best I can offer without seeing your sample workbook.

5. Originally Posted by AliGW
Most probably, but it's the best I can offer without seeing your sample workbook.
Seems I am nearly there now with:
=IF(O2<18.5,"Underweight",IF(AND(18.5<=O2,O2<=24.9),"Normal",IF(AND(25<=O2,O2<=29.9),"Overweight"))) Working

Just adding the last argument like below it says there are too many arguments.. dont understand why it works with 3 ifs but not with 4 ifs:

=IF(O2<18.5, "Underweight",IF(AND(18.5<=O2,O2<=24.9),"Normal"),IF(AND(25<=O2,O2<=29.9),"Overweight"),IF(O2>30,"Obesity"))

6. Try:
Code:
`=INDEX({"Underweight";"Normal";"Overweight";"Obesity"},MATCH(O2,{0;18.5;25;30}))`
or:
Code:
`=VLOOKUP(O2,{0,"Underweight";18.5,"Normal";25,"Overweight";30,"Obesity"},2)`

7. Originally Posted by p45cal
Try:
Code:
`=INDEX({"Underweight";"Normal";"Overweight";"Obesity"},MATCH(O2,{0;18.5;25;30}))`
or:
Code:
`=VLOOKUP(O2,{0,"Underweight";18.5,"Normal";25,"Overweight";30,"Obesity"},2)`

Thank you so much, the first one with the INDEX is working perfect !!! Finally!!

8. You can also do it with just simple IFs

=IF(O2<18.5,"Underweight",IF(O2<=24.9,"Normal",IF(O2<=29.9,"Overweight","Obese")))

9. Originally Posted by Bob Phillips
You can also do it with just simple IFs

=IF(O2<18.5,"Underweight",IF(O2<=24.9,"Normal",IF(O2<=29.9,"Overweight","Obese")))
Great, thank you very much!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://www.excelguru.ca/forums/showthread.php?10947-IF-Formula&s=9127655231db58931b79ab2065183088&p=45207", "fetch_time": 1611605930000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2021-04/segments/1610703644033.96/warc/CC-MAIN-20210125185643-20210125215643-00705.warc.gz", "warc_record_offset": 764674028, "warc_record_length": 13189, "token_count": 738, "char_count": 2272, "score": 3.5625, "int_score": 4, "crawl": "CC-MAIN-2021-04", "snapshot_type": "latest", "language": "en", "language_score": 0.865918755531311, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00051-of-00064.parquet"}