Forum Discussion
Formulas to add info to cell based on a WORD in another cell
- Sep 26, 2019
So if all you need is to populate the column F based on province entered in column A, you may try something like this...
In F2
=IF(A2="","",IFERROR(VLOOKUP(A2,Subnet,2,0),""))
I have inserted a new sheet called "Lookup" where you can list all the provinces and their subnet.
I have also created a dynamic Named Range called "Subnet" which is used in the formula above.
You may add more provinces and their details on Lookup Sheet and your formula will be updated automatically as per the province you enter in column A if that province exists on Lookup Sheet.
So if A2 is AB, the formula will return 192.102. in F2.
But if you want F2 to return 192.102.1.0 in F2 as you showed in the cell F8 (green cell), you may tweak the formula as...
=IF(A8="","",IFERROR(VLOOKUP(A8,Subnet,2,0)&"1.0",""))
It would be much easier to visualize what exactly you are trying to achieve if you upload a small sample file along with the desired output mocked up manually and an explanation which justify your desired output in the next column for few rows.
Btw #NAME? error simply means that Excel doesn't recognize the formula you are using or an incorrect formula e.g. in your formula you need to surround the words with double quotes like "MB", "AB" etc.
And if you miss those double quotes Excel assumes MB, AB etc are some functions which it doesn't recognize and produces that error.
- RandyD79Sep 26, 2019Copper Contributor
Thanks for the reply!
Basically, this is what it would look like:
Cell A has a list of Province Acronyms, Cells B through E don't mean anything to this cell (They're their own thing.
I'm building out hundreds of these things, and they have IP addresses based on their province, and eventually, there may be other's that will build as well, and we need to know what addresses we are using so that there's no errors or overlap.
Basically, the cells in F should look to see what acronym is in cell A, and add in the correct first half of the IP range. The F column will eventually be hidden, and the last half will be added in manually based on the previous ranges for that same province, producing the full IP address. Similar things will occur for an additional five IP's per device based on other factors that will grab from F column and others.
- Subodh_Tiwari_sktneerSep 26, 2019Silver Contributor
Thanks for the image, though images are not very helpful and difficult to work with.
I requested you to upload a sample Excel file not the image along with the desired output mocked up manually. Please do so if possible.
- RandyD79Sep 26, 2019Copper Contributor
Ahh okay. Here is basically what I am doing. I have a section highlighted in green that is what I'll be slowly building in to get our finished products and all the info.