Matching numbers in two arrays and displaying text

LookingForExcel

New Member
Joined
Jan 4, 2022
Messages
6
Platform
  1. MacOS
I am looking to create a formula that would be able to identify if there was a match in an array and if there was then display "Orange" and if there was no match to display "Green"

For example

Array 1TextArray 2
1357orange1357
3478green5789
5789orange1437
1788green
1437orange

Any help is appreciated, thank!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Book1
ABCD
1Array 1TextArray 2
21357orange1357
33478green5789
45789orange1437
51788green
61437orange
Sheet1
Cell Formulas
RangeFormula
B2:B6B2=IF(ISNA(MATCH($A2,$D$2:$D$4,0)),"green","orange")
 
Upvote 0
Bieu gio-R1 (1).xlsx
ABCD
1Array 1TextArray 2
21357Orange1357
33478Green5789
45789Orange1437
51788Green
61437Orange
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=IF(COUNTIF($D$2:$D$4,$A2)=0,"Green","Orange")
 
Upvote 0
Hi @JoeMo @Phuoc! Thanks so much for your help on that I really appreciate it. I've run into a more complex problem that I think can be fixed just by building off of previous formulas. Listed below is an example.

I'm working with zipcodes here, I want to know if the zip code is a primary zip code (orange) or a secondary zip code (yellow), and if it is not either of those to display a separate color (green). Based on that information to display a corresponding color.

ABCDE
All zipcodecolorPrimary ZipcodeSecondary Zipcode
112233orange112233223344
223344yellow678678378378
567567green454545876543
454545orange182731674532
378378yellow832145793134

Is it possible?
 
Upvote 0
How about
Excel Formula:
=IF(COUNTIFS($D$2:$D$6,A2),"Orange",IF(COUNTIFS($E$2:$E$6,A2),"Yellow","Green"))
 
Upvote 0
Thank you for that @Fluff ! I'm just curious, would it be possible to add to that equation to include a third set of zip codes and display another color accordingly? I'm trying to understand if that would be possible or how to add onto the formula you listed above.

All zipcodecolorPrimary ZipcodeSecondary ZipcodeThird set of Zipcodes
112233orange112233223344888555
223344yellow678678378378787431
567567green454545876543674284
454545orange182731674532543121
378378yellow832145793134111222
888555blue

In this set there is a new column and the last zipcode in "All zipcode" is a match with the first zipcode in the "third set of zipcodes" column and displays the word "blue". Sorry for this addition but I was not anticipating this many sets of data.
 
Upvote 0
Try
Excel Formula:
IF(COUNTIFS($D$2:$D$6,A2),"Orange",IF(COUNTIFS($F$2:$F$6,A2),"Blue",IF(COUNTIFS($E$2:$E$6,A2),"Yellow","Green")))
 
Upvote 0

Forum statistics

Threads
1,203,460
Messages
6,055,556
Members
444,796
Latest member
18ecooley

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