If column E contains x - do this, if contains y - so that, etc

mtaylor

Board Regular
Joined
May 1, 2013
Messages
73
Platform
  1. Windows
  2. MacOS
Hi - thanks for looking.

I have responses being inputted to a sheet and I want formulas run depending on the text in cells in Column E

The different responses are:

Double Sided, A4
Double Sided, A5/2 On 1pg
Double Sided
Single Sided
Double Sided
Single Sided

Then the formulas in column H are:

=((ROUNDUP(F2/2)*G2))

=((ROUNDUP(F3/4)*G3))

=((ROUNDUP(F4/2)*G4))

=G5*F5

=((ROUNDUP(F6/2)*G6))

=G7*F7


repro sheet.JPG


So for example:

If E3 says "Double Sided, A4" I want the formula "=((ROUNDUP(F2/2)*G2))" to be run etc

Hopefully this makes a little sense?

Thanks in advance
 
Thank you,

I need all the formulas in one cell though, hence I was looking at the IFS function.

Where have I gone wrong here:

=IFS(E2="Double Sided, A4",((ROUNDUP((F2/2)*G2)),""),(E2="Double Sided, A5/2 On 1pg",((ROUNDUP(F2/4)*G2)),""),(E2="Double Sided",((ROUNDUP(F2/2)*G2)),""),(E2="Single Sided",(G2*F2),""))

That IS a formula in ONE cell, I just gave you 2 versions, use ONLY the one in H2, copied down.
My sample above in Post #6, H2 is just a different version of my I2 formula, you DON'T need Both, just Either one.

I Don't think you actually tried my formulas.

You Don't need a lengthy IFS.

Book3.xlsx
EFGH
1#Original#Copy#Printouts
2Double Sided, A422020
3Double Sided, A5/2 On 1pg884168
4Double Sided384168
5Single Sided32678
6Double Sided31020
7Single Sided2612
Sheet1045
Cell Formulas
RangeFormula
H2:H7H2=ROUNDUP(F2/MAX(SUM(COUNTIF(E2,{"*2 On 1*","*Double*"}))*2,1),0)*G2
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
@jtakw, I got a different result to you on row 6 Double Sided. I got 15 to your 20.
The formula in Post #1 results in 15 despite the image in post #1 showing 20.
 
Upvote 0
@jtakw, I got a different result to you on row 6 Double Sided. I got 15 to your 20.
The formula in Post #1 results in 15 despite the image in post #1 showing 20.

Don't know what result your formula would produce for row 6, I don't have IFS

But OP's formula for row 6 is: =((ROUNDUP(F6/2)*G6))

which is missing the "number digits" argument, assume should be 0

Will return 20.

Logic:

Double sided>original/2>roundup>*# of Copies
Yes>3/2=1.5>2*10=20

EDIT: looking at your formula, you're *G6 First, then ROUNDUP, but OP's incorrect formula Closed the ROUNDUP function Before *G6, the missing "number digits" argument is here:

=((ROUNDUP(F6/2)*G6))

2nd EDIT: If the ROUNDUP is performed After *G6, I don't even see a need for the ROUNDUP at all, for Any of the scenarios.
 
Last edited:
Upvote 0
Change F6 to 1, your formula will result 5, does that make sense?

1 Double sided original, 10 copies, 5 Total Prints???

Mine results 10.

Book3.xlsx
EFGH
1#Original#Copy#Printouts
2Double Sided, A422020
3Double Sided, A5/2 On 1pg884168
4Double Sided384168
5Single Sided32678
6Double Sided11010
7Single Sided2612
Sheet1045
Cell Formulas
RangeFormula
H2:H7H2=ROUNDUP(F2/MAX(SUM(COUNTIF(E2,{"*2 On 1*","*Double*"}))*2,1),0)*G2
 
Upvote 0
Thanks @jtakw, I haven't logged in for the day yet but your logic makes it clear my current formula is incorrect. I will post a corrected "if" version later, in case the OP would prefer to stick with using an if statement.
 
Upvote 0
If I'm interpreting OP's logic incorrectly, and row 6 should be (double side 3 original = 15 prints, double side 1 original = 5 prints), then as I mentioned, the ROUNDUP is pointless.

And my formula will be even simpler:

Book3.xlsx
EFGH
1#Original#Copy#Printouts
2Double Sided, A422020
3Double Sided, A5/2 On 1pg884168
4Double Sided384126
5Single Sided32678
6Double Sided31015
7Double Sided1105
8Single Sided2612
Sheet1045
Cell Formulas
RangeFormula
H2:H8H2=F2/MAX(SUM(COUNTIF(E2,{"*2 On 1*","*Double*"}))*2,1)*G2
 
Upvote 0
Thanks @jtakw, I haven't logged in for the day yet but your logic makes it clear my current formula is incorrect. I will post a corrected "if" version later, in case the OP would prefer to stick with using an if statement.

That may not be necessary, my last post above, I may have mis-interpreted OP's logic.
You would be correct, if.

Column E, printing on Double side
Column F, 3 originals
Column G, 10 copies
Column H, you would only need 15 sheets of paper, so # of prints=15

But, I guess, the ROUNDUP threw me off if this is the logic, my formula adjusted in Post # 16 if this is the case. (basically took out ROUNDUP)
 
Upvote 0
@mtaylor, I believe that @jtakw has correctly analysed your intent and that my initial formula which you have marked as a solution is not giving you a correct result.
Assuming #Printouts represents the number of sheets of paper required, my formula is returning 15 pages for Row 6 Double Sided and it should be 20.
(an original of 3 pages, that doesn't share pages with additional copies requires 2 pages per original in Row 6 this means 2 pages x 10 copies = 20 pages not my 15)

You can either run with jtakw's solution or still using "IFS" this:
Excel Formula:
=IFS(E2="Double Sided, A5/2 On 1pg",ROUNDUP(F2/4,0)*G2,
         COUNTIF(E2, "Double Sided*"),ROUNDUP(F2/2,0)*G2,
         COUNTIF(E2,"Single Sided*"),G2*F2,
         TRUE,"")

Or Closer to the Original, just moving the rounding.

Excel Formula:
=IFS(E2="Double Sided, A4", ROUNDUP(F2/2,0)*G2,
         E2="Double Sided, A5/2 On 1pg",ROUNDUP(F2/4,0)*G2,
         E2="Double Sided",ROUNDUP(F2/2,0)*G2,
         E2="Single Sided",(G2*F2),
         TRUE,"")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,367
Members
449,080
Latest member
Armadillos

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