I am trying to calculate a price based on rates. If the number is $20,000 or below, there is a flat rate of $700. If the number is between 20,001.01 and $50,000, the rate is 3.5% of the number. The rates continue to lower as the numbers go up. I can get Google Sheets to populate the box with $700 if it is below $20,000 but I can't seem to make it do the multiplication for me. The cell just shows C4*.035
I want it to multiply the number shown in the C4 square by the percentage listed.
Here is the code as it currently sits:
=if(AND(C4<=20000),"700",IF(AND(C4>=20000.01,C4<=50000),"C4*.035", IF(AND(C4>=50000.01,C4<=100000),"C4*.0325", IF(AND(C4>=100000.01),"C4*.03"))))
Note, I know nothing about coding so I apologize if it is sloppy or doesn't make sense. I tried to copy and format based on an example that was semi similar to mine.
try:
=IF(C4<=20000, 700,
IF(AND(C4>=20000.01, C4<=50000), C4*0.035,
IF(AND(C4>=50000.01, C4<=100000), C4*0.0325,
IF(AND(C4>=100000.01), C4*0.03))))
As BigBen noticed in his comment - there's a mistake in your formula. You should not use " " around the formula if you don't want it to be read as a string.
Actually more clean solution is using IFS formula for this task.
=ifs(C4<=20000,700,
C4<=50000,C4*0.035,
C4<=100000,C4*0.0325,
C4>100000,C4*0.03)
Related
I have a column of values that are a number out of 10. So, it could be 2/10, 3/10, 4/10 and so on, all the way up to 10/10. To be clear, these are not dates, but simply showing how many questions the student answered correctly out of 10.
I'm trying to use conditional formatting to highlight them a certain color depending upon the score they got. For 9/10 and 10/10, I'm wanting to use a certain color, but it doesn't seem to be working with REGEXMATCH or with OR. Also wanting to highlight all scores that are 6/10 or lower. I know that I could make this work by applying conditional formatting for each and every score with text contains but the problem I'm finding is that it thinks it's a date.
Is there a way to match multiple scores out of 10 using REGEXMATCH?
Link to Sheet
select column and change formatting to Plain text
now you can use formula like:
=REGEXMATCH(A1; "^9|10\/")
I am trying to specify a time that starts a shift premium for a time card. I was so happy I finally figured out how to get it, but then I changed a time to a first shift time and thats when I lost all hope. I have spent hours messing with this and my current formula's looks like
x1.05
=IF(COUNT(A20:B20)=2,MOD($B$18-A20,1)*24,"")
x1.1
=IF(COUNT(A20:B20)=2,MOD(B20-$B$18,1)*24,"")
My end goal is to have it so first shift (7am - 3pm) fall under base pay, 2nd shift (4pm-12am) fall under x1.05 and anything past 12am falls under x1.1
Just getting this far has been a mind blower for me and any help would be greatly appreciated.
I have moved this to its own sheet to share with everyone. I am still playing with things myself and trying different things, but on the sheet I have included the variables along with the wording of the contract that effects the pay scale. NOTE the times I originally provided were just examples from the top of my head.
My Sheet
It doesn't look like your current sheet accounts for the multiple criteria you're wanting to evaluate. First shift (x1) begins at 7; second shift (x1.05) begins at 15:00, and third shift (x1.10) begins at 24:00.
I added each of those directly above the columns they affect and used this formula for the Base column:
=IF(COUNT($A20:$B20)=2,IF($A20<F$18,(MOD(MIN(F$18,$B20)-$A20,1))*24,0),"")
...this for the x1.05 column:
=IF(COUNT($A20:$B20)=2,IF($A20<G$18,(MOD(MIN(G$18,$B20)-$A20,1)*24)-E20,0),"")
...and this for the x1.10 column:
=IF(COUNT($A20:$B20)=2,(MOD(MIN(E$18+1,$B20)-$A20,1)*24)-SUM(E20:F20),"")
So far, it's working as expected. One thing I didn't add into it is to account for someone who starts their shift before 7 a.m. If you want this to be included in the x1.10 column, you could add a calculation for that to the formula there.
Here's what it looks like:
I'm working in Excel, but these formulas should all work in Google Sheets as well.
I have a formula. It works - but feels like it could be made much simpler.
I have many departments across several columns. Each row has an item that we're tracking and each column has a status text that changes as we do the work.
'queue' - it's in line waiting to be done and weighs down the average
'active' - in process and provides a half value across the average
'done', 'ok'd', 'rcvd' - finished and contributes to the final average
'none' - denotes a department that's inactive on this job and should not count in the final average.
The formula is:
=iferror(((ArrayFormula(sum(countif(B3:O3,{"done","ok'd","rcvd"}))))+(countif(B3:O3,"active")/2))/(counta(B3:O3)-(countif(B3:O3,"none"))),)
The formula works but I'm looking to see if there's an easier way to approach it. Would a query or array modification work better in this scenario?
What if I wanted to add other text strings based on syntax for my current application?
Here's a link to a sample sheet with it in context.
https://docs.google.com/spreadsheets/d/1zPFAcSxM7tYjZmlATYde7qKsDoeH6AW_xjFooOZFOf4/edit#gid=0
EDIT:
As a followup question - how do I get the same thing to work across the columns?
I did some reverse engineering to the solution and can see the formula working across the top of my sheet - but it's giving me an error:
"MMULT has incompatible matrix sizes. Number of columns in first matrix (13) must equal number of rows in second matrix (1)."
Here's the formula I've added (it's also in the linked sheet).
=ARRAYFORMULA(IF(LEN(B4:N4), MMULT(IFERROR(( N(REGEXMATCH(B4:N9, "ok'd|done|ready|rcvd"))+ N(REGEXMATCH(B4:N9, "active"))/2)/MMULT(N(REGEXMATCH(B4:N9, "[^none]")),TRANSPOSE(ROW(B4:B9)^0)), 0), TRANSPOSE(ROW(B4:B9)^0)),))
As a followup question - how do I get the same thing to work across the columns?
=ARRAYFORMULA(TRANSPOSE(IF(LEN(TRANSPOSE(B4:N4)), MMULT(IFERROR((
N(REGEXMATCH(TRANSPOSE(B4:N16), "ok'd|done|ready|rcvd"))+
N(REGEXMATCH(TRANSPOSE(B4:N16), "active"))/2)/MMULT(
N(REGEXMATCH(TRANSPOSE(B4:N16), "[^none]")),
(ROW(B4:B16)^0)), 0),
(ROW(B4:B16)^0)), )))
=ARRAYFORMULA(IF(LEN(B3:B9), MMULT(IFERROR((
N(REGEXMATCH(B3:N9, "ok'd|done|ready|rcvd"))+
N(REGEXMATCH(B3:N9, "active"))/2)/MMULT(
N(REGEXMATCH(B3:N9, "[^none]")),
TRANSPOSE(COLUMN(B3:N3)^0)), 0),
TRANSPOSE(COLUMN(B3:N3)^0)), ))
Is there a way to do conditional formatting in python the way it is in excel?
Example.
Lets say I have the number 5 as average.
If I have a number which is 20% higher than the avaerage I want it to be displayed in the color green
Same for when I have a number which is 20% lower. Than I want the number to be red.
Been trying to figure it out without succes
It's a little bit difficult to understand the context that you want to create the conditional formatting in. If you are referring to formatting data in a pandas dataframe, I think that's impossible. On the other hand, if you're writing your output from python to excel using xlsxwriter then conditional formatting is pretty easy. Though I don't know how to mark 20% above average, the examples here show you how to write conditionally formatted cells that are a certain number of standard deviations above average or that are in the top x%. I hope this helps.
I have a worksheet that has become very complex. On it, there is a sheet in which a user will paste data about once every other day. The data will always be in the same format, and is provided to us in an exact way only. Once pasted in, I need a way for a very average user of excel to be able to press a button (or key combo, or whatever) and excel will run a series of about 8-10 regex find and replaces. All of these will be on column A of the data. Once those are all run, a simple formula would be run on every cell C2 and below in column C. Those columns should be reduced by 80% - =C2*.8
This should all be done with minimal user input if possible.
Would anybody much more versed in regex or excel know a better direction for me to look for a proper start? What resources would be recommended to best accomplish this?
If you're multiplying by some factor, then regexp substitution will be overkill. Excel is very good at multiplying an array of numbers by 0.8.
Search for "Excel paste factor" and you'll get an easy explanation, such as this one.
I might record a macro for your less-experienced users and hope that the previous user pasted the numbers in with absolute perfection.