If value is contained in array

AndrewMD

New Member
Joined
Jun 1, 2017
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi Helpful folks of MrExcel, hope you can help me with this problem I've been stuck on.

I have an array of values in one column and in two other columns I have the year and an amount.

What I'm trying to so is create a third column (H) and say if year is contained in array *2, otherwise *1. etc

This won't work for me, not sure what I'm doing wrong! {=IF(F2=$A$2:$A$6,G2*2,G2*1)}

Thanks!


1707922106436.png
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
=IF(countif($A$2:$A$6,F2)>0,G2*2,G2)
copy down

Book1
ABCDEFGH
1
221101101
342102204
463103103
584104208
6105105105
76106212
87107107
98108216
109109109
1110110220
1211111111
1312112112
1413113113
Sheet1
Cell Formulas
RangeFormula
H2:H14H2=IF(COUNTIF($A$2:$A$6,F2)>0,G2*2,G2)
 
Upvote 0
You have been given two formulas that require you to copy them down; but, since you are using XL365, you can place this single formula in cell H2 and it will automatically spill the results down for you...
Excel Formula:
=IF(COUNTIF(A2:A6,F2:F11),2*G2:G11,G2:G11)
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
Latest member
Mr Hughes

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