Populating a Column Based Off of Two Columns Values

MDean3313

New Member
Joined
Jul 8, 2019
Messages
13
Hi Everyone,

I've posted a similar question, but am having new troubles.

One column has 4 values, T12, T8, empty cells, and #VALUE !. The second column has values 1 through 4.

The new column needs to take the value from the second column (numbers 1-4) and match it to a title. For example, if a cells value is 1, the new column would say "Metropolitan", if it's 2, the new column would say "Micropolitan", if 3, the new column would say "Small Town" and 4 would be "Urban."

Additionally, I want to only populate the new column if it correlates with "T12" or "T8" and to leave blank if there is an empty cell or a #VALUE ! from the other column.

Let me know if you have any questions and thanks for the help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Is one of these what you want?


Book1
ABCDEF
1Column AValueExtractExtract2
2T121MetropolitanMetropolitan
3T82MicropolitanMicropolitan
4T123Small TownSmall Town
5T124UrbanUrban
61Urban
72Metropolitan
8#VALUE!3
9T124Urban
10#VALUE!1
11T81Metropolitan
12
Sheet1
Cell Formulas
RangeFormula
F2=IFERROR(IF(OR(A2={"T12","T8"}),CHOOSE(B2,"Metropolitan","Micropolitan","Small Town","Urban"),""),"")
D2{=IFERROR(CHOOSE(INDEX($B$2:$B$20,SMALL(IF(NOT(ISERROR($A$2:$A$20)),IF(LEFT($A$2:$A$20)="T",ROW($A$2:$A$20)-ROW($A$2)+1)),ROWS($D$2:$D2))),"Metropolitan","Micropolitan","Small Town","Urban"),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Slightly shorter versions of both formulas:


Book1
ABCDEF
1Column AValueExtractExtract2
2T121MetropolitanMetropolitan
3T82MicropolitanMicropolitan
4T123Small TownSmall Town
5T124UrbanUrban
61Urban
72Metropolitan
8#VALUE!3
9T124Urban
10#VALUE!1
11T81Metropolitan
Sheet1
Cell Formulas
RangeFormula
D2=IFERROR(CHOOSE(INDEX($B$2:$B$20,AGGREGATE(15,6,(ROW($B$2:$B$20)-ROW($B$2)+1)/(LEFT($A$2:$A$20)="T"),ROWS($D$2:$D2))),"Metropolitan","Micropolitan","Small Town","Urban"),"")
F2=IF(ISERROR(RIGHT(A2)+0),"",CHOOSE(B2,"Metropolitan","Micropolitan","Small Town","Urban"))
 
Upvote 0
Is one of these what you want?

ABCDEF
1Column AValueExtractExtract2
2T121MetropolitanMetropolitan
3T82MicropolitanMicropolitan
4T123Small TownSmall Town
5T124UrbanUrban
61Urban
72Metropolitan
8#VALUE!3
9T124Urban
10#VALUE!1
11T81Metropolitan
12

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
F2=IFERROR(IF(OR(A2={"T12","T8"}),CHOOSE(B2,"Metropolitan","Micropolitan","Small Town","Urban"),""),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D2{=IFERROR(CHOOSE(INDEX($B$2:$B$20,SMALL(IF(NOT(ISERROR($A$2:$A$20)),IF(LEFT($A$2:$A$20)="T",ROW($A$2:$A$20)-ROW($A$2)+1)),ROWS($D$2:$D2))),"Metropolitan","Micropolitan","Small Town","Urban"),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Thank you for this Eric!
The Worksheet Formula was able to solve my problem.
I really appreciate the help!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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