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",""))
Thanks for the sample file.
It is still not clear to me that which column you want to populate with the formula depending on the province in column A.
If I read your original description which is as below...
If cell A2 has the word 'MB' in it, then it should add '192.104.'
If cell A2 has the word 'SK' in it, then it should add '192.103.'
If cell A2 has the word 'AB' in it, then it should add '192.102.'
If cell A2 has the word 'BC' in it, then it should add '192.101.'
All I understand is, the formula should look at the province in column A and add the network path (e.g. if province is MB, add 192.104.) but the question is, add 192.104. to what?
Can you explain your desired output for the first row and let me know if the province in A2 is AB and F2 is 192.102., which column you would be populating based on these two values?
Also, how many provinces you may have in column A? It would be easy to construct the formula if you create a Lookup table somewhere on the sheet or on another sheet to get what network path you need to add as per the province present in column A to avoid a long nesting IF formula.
OR
You want to populate the column F based on the province in column A?
e.g.
If cell A2 has the word 'AB' in it, then populate F2 with 192.102.?
Sorry, So column F should be blank until a province is added into column A. There's only four provinces that I'm doing this for. No idea if we'll ever expand into more or not.
Column G and H are literally a drag down to get the next corresponding numbers. No formulas required.
Columns I, J and K are all based on the information in column F
- Subodh_Tiwari_sktneerSep 26, 2019Silver Contributor
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",""))- RandyD79Sep 26, 2019Copper ContributorFascinating! Thank you very much!
- Subodh_Tiwari_sktneerSep 26, 2019Silver Contributor