IF statement is not using correct values

EmPhetts

New Member
Joined
Dec 14, 2016
Messages
2
Hello,

I'm working on an Excel file to display the network class, subnet mask, etc. based on entered IP addresses.
An IF statement is giving me trouble and I'm pretty sure it's a simple rule or format I'm unfamiliar with.
With an IP of 192.168.1.1 in Cell A3, I used =FIND(".",A3,1) in Cell A1 to identify the location of the first decimal point and =MID(A3,1,A1-1) in Cell D1 to display the first octet, 192.
My issue is that when referencing Cell D1 to determine the address class, the IF statement is not displaying the correct result.

ABCDEFG
1481019216811
2IP AddressClassN
3192
4192

<tbody>
</tbody>

For troubleshooting I tried the following...
1. Cell D2 =IF(D1=192,"Y","N")
2. Cell D3 =D1 [192 is aligned left in the cell]
3. Cell D4 192 [192 is aligned right in the cell]
When the IF statement in cell D2 references
· D1 N is displayed
· D3 N is displayed
· D4 Y is displayed
Can anyone tell me why the IF statement is working only with Cell D4?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Here is why:

Your formula =MID(A3,1,A1-1) returns "192" as a text string, not 192 as a number.

So, to make your IF work, it should be entered like this: =IF(D1="192","Y","N")

If you want 192 as a number in cell D1, you can use =--MID(A3,1,A1-1)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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