Conditional Formatting (If cell value in row column A = 3 or 5 or etc... then cell value B = 1 or 2).

griffindor2020

New Member
Joined
Jun 6, 2020
Messages
20
Office Version
  1. 2016
Platform
  1. MacOS
Hello,

I was wondering if I could tell excel to insert a value (1 or 2) along all of column B, based off the values that are in column A.

For example

If A = 1 or 3 or 5 or 6 or etc... Then values in column be should be 1.
and
If A = 2 or 4 or 7 etc... Then values in column B should be 2.

Is there a way to code this ?

I have approximately 100 000 rows of data. I hope someone will be able to help me save some time :)

Thank you :)
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
How many different numbers do you have in col A?
 
Upvote 0
Ok, if you want even numbers to be 2 & odd numbers 1, you can use
=ISEVEN(A2)+1
Failing that
either something like
=ISNA(MATCH(A2,{1,3,5,6},0))+1
or create a lookup table of the numbers & what they should return.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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