 SOLVED

# help with formula

I am sorry if this is simple but I just cannot figure it out. I have a drop down data column with three sizes, 4x6, 5x7, and 9x4 in column A. in column D my heading is "cards per sheet". If I select "4x6" it should say"20" in column D. If "5x7" - "16", and if "9x4" - "15".

I cannot figure out how to use an IF statement to return those values. What can I do?

7 Replies

# Re: help with formula

Let's say the drop-downs are in A2 and below.

Enter the following formula in D2, then fill down:

=IF(A2="4x6",20,IF(A2="5x7",16,IF(A2="9x4",15,"")

# Re: help with formula

Or use a lookup table. The first column can be the source for the data validation drop-down.

In the screenshot below, the table is named Sizes. The formula in B2 (on your worksheet it would be D2) is

=IFERROR(VLOOKUP(A2,Sizes,2,FALSE),"")

If you have Microsoft 365 or Office 2021, you can also use

=XLOOKUP(A2,Sizes[Size],Sizes[Cards per Sheet],"")

# Re: help with formula

Thanks for that info. So, in the first example I always get an error that says there was a typo in the formula, and it tries to correct it. But then I get an error that says, "The value doesn't match the data validation restrictions, defined by this cell."

In Column A2 I have a data validation criterion of, "list" and in the Source I have 4x6, 5x7, and 9x4. That creates the drop-down values in column A2. This is how the "form" looks: # Re: help with formula

Could you attach a sample workbook (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar? Thanks in advance.

# Re: help with formula

sure! There's no sensitive data. Just working out the basic spreadsheet.
https://1drv.ms/x/s!Ag5CIttUj0lyiolPe-WH_GyAh0ZDcg?e=76Ftg0
best response confirmed by JohnShaw19 (New Contributor)
Solution

# Re: help with formula

I forgot 2 closing parentheses - sorry about that. The first formula should be

=IF(A2="4x6",20,IF(A2="5x7",16,IF(A2="9x4",15,"")))

But you have set up date validation for D2 that only allows the values 1, 2, ..., 10. So 20, 16 and 15 will be rejected.

I'd remove the data validation from D2. If you use a formula, data validation is not needed.

# Re: help with formula

That was it!!! Thanks so much! I honestly do not remember putting data values in D2. So much appreciate your help.