ARRAYFORMULA Enter data if relevant but allow user input if not - if-statement

I want a table to auto-fill if we have the data to input but allow user input if not. I've tried using an ARRAYFORMULA but if the user enters data into an empty field, the formula breaks.
Example:
A B C
1|Date Policy *This cell contains formula below*
2| 1/1 High 6 Days
3| 2/1 Med 4 Days
4| 3/1
5| 4/1 Low 2 Days
=ARRAYFORMULA(IF(B2:B5="High","6 Days",IF(B2:B5="Med","4 Days",IF(B2:B5="Low","2 Days",""))))
I want the user to be able to input their own data in cell C4 (and B4) without it affecting the arrayformula
The empty row could be anywhere, it wont always be row 4

this is certainly not an exact answer to your question, but this solution allows you to do without using scripts - the user can enter data in another column (here column D) on this line, and the formula will search the result in B and if it is empty, then in D
=ArrayFormula(IFNA(VLOOKUP(B2:B5,G1:H3,2,false),VLOOKUP(D2:D5,G1:H3,2,false)))

Related

power automate desktop - convert list into data table

I read some text from a pdf into Power automate desktop. It is in the form of a list like
0 | 123 Testing Company 23.00
1 | Generation Z Co 555.11
2 | Tea Company 1,234.99
I need to separate the list into columns where the number at the end of the element is in its own column like
0 | 123 Testing Company | 23.00
1 | Generation Z Co | 555.11
2 | Tea Company | 1,234.99
Is there a way to do this? I've tried to extract tables from PDF instead but this method does not return the right data, because it seems PAD doesn't recognize it as a table.
Is there a way to convert a list into a data table?
The only way seems to be to For Loop the List,
Parse Text each of the columns
and insert them each as a row to the Data table.
i feel like there should be a quicker way to do this.

DAX compare to previous row and update upstream rows per condition

I am struggling in solving the following requirement on table attached.
I need to create a “Cross location” column where the result of the column looks on previous row and compares if the value on the location column matches.
If it does than the output is “No” but if it doesn’t it outputs “Yes” to all upstream rows of the Group which is indexed by the task number column.
** This is as small portion of the table which consists many groups and multiple task numbers which not always starts with 1 put per group is always consecutive.
Appreciate your support - table of interest attached in picture
enter image description here
Group task number location Cross location
A 1 CAT
A 2 CAT No
A 3 TGR Yes
A 4 TGR Yes
A 5 JGR Yes
A 6 CAT Yes
B 19 JGR
B 20 CAT Yes
B 21 CAT Yes
B 22 TGR Yes

Can I make the values of an IF function into equations?

I'm working on a simple budget sheet in Google Sheets, and want to know if I can make the values of an IF function into an equation.
Column A describes the activity (as in, purchased DVD, received paycheck, etc).
Column B lists the amount of the activity if it was income; otherwise, it remains blank.
Column C lists the amount if the activity was an expense; otherwise, it remains blank.
Column D is my total amount, which takes the total amount in the cell directly above it and either adds to that value with the value in column B, or subtracts from that value with the value in column C. I have to personally input that equation, which is pretty time-consuming.
I was hoping to use column E to be a row that I mark as "Y" if that row was income. Otherwise, I would leave it blank.
Then I wanted to replace the equation in column D with an IF statement that checks if column E has a "Y" in it. If it does, then it performs the addition equation using columns D and B. (And if E is blank, then the equation simply has column C subtracted from column D.)
Say I have the following table:
1. Col. A || Col. B || Col. C || Col D.
1. Event || Income || Expense || Total
1. START VAL.||--------||---------|| $100.00 ||
2. Hamburger ||--------|| $10 || =D3-C4 ||
3. Paycheck || $20 ||---------|| =D4+B5 ||
Instead, I'm hoping to add column E so the table looks like this:
1. --Col. A---||-Col. B-||--Col. C-||----Col D.----||-Col. E----||
2. --Event----||Income--||-Expense-||----Total-----||-Is Income?||
3. STARTVAL. ||--------||---------||-----$100-----||-----------||
4. Hamburger ||--------|| $10 ||--*FORMULA 1*-||-----------||
5. Paycheck ||--$20---||---------||--*FORMULA 2*-||-----Y-----||
I thought that the FORMULA 1 would have to look like this:
=IF(E4="Y",(D3+B4),(D3-C4))
Formula 2 would look like this:
=IF(E5="Y",(D4+B5),(D4-C5))
You can see that having to update each cell by 1 depending on if it's income or an expense is inefficient...
I would expect column E to cause the IF function in column D to produce new equations depending on the value in column E, but all I get in Google Sheets is
Formula Parse error
try this formula in D4 cell and drag down:
=IF(E4="Y"; D3+B4; D3-C4)
if that works delete everything in range D4:D and paste this in D4 cell:
=ARRAYFORMULA(IF(LEN(A4:A); IF(E4:E="Y"; D3:D+B4:B; D3:D-C4:C); ))

AWS quicksight parseInt() returns null

I'm trying to generate a QuickSight analysis with a simple .csv file. The file contains some arbitrary data like
Yifei, 24, Male, 2
Joe, 30, Male, 3
Winston, 40, Male, 7
Emily, 18, Female, 5
Wendy, 32, Female, 4
I placed the file in an S3 bucket, and then use AWS Athena to parse that into a table. The table treats all columns as strings, and I can query it properly
SELECT * FROM users
returns
name age gender consumed
1 Yifei 24 Male 2
2 Joe 30 Male 3
3 Winston 40 Male 7
4 Emily 18 Female 5
5 Wendy 32 Female 4
Okay so far so good. Then in QuickSight, I import the table as dataset, and it's properly displayed under fields with the correct values. The only problem remaining is that age and consumed are treated as strings, not numbers. So, I created two calculated fields:
age_calc: parseInt({age})
consumed_calc: parseInt({consume})
Works just fine, now under the fields I can see the newly created fields with correct values. However, once I try to create actual visualization (For example, a pie chart with how much everyone consumed) using the field consumed_calc, the value of consumed_calc is just null.
I found the issue. Basically, csv does not work very well with spaces, so despite the calculated fields showing correct result in preview, when parsed the field " 23" gets an error. Removing the spaces in the original .csv file solved this issue

Using ArrayFormula for a running total causes a circular reference

See attached Google Sheet for example/sample of my issue. I am trying to use an ARRAYFORMULA() to keep a running total in column C, based on adding the previous row's value in column C with the current row's value in column B. Before I make it an ARRAYFORMULA, it works fine. In column F-H, you can see I tried the array version and get a "circular dependency" error.
The working formula:
=B3+C2 (this is in cell C3)
The non-working formula (with the desired ARRAYFORMULA):
=ArrayFormula(G3:G+H2:H) (this is in cell H3)
My question is, what adjustments can I make to my formula that will allow me to auto-fill this formula down the page as new rows are added (and not populating data for blanks).
Name Days Total Days
Jane 5 6
Tom 2 8
Billy 4 12
Sue 6 18
Sally 1 19
Sample document
=ARRAYFORMULA(IF(B2:B="", ,SUMIF(ROW(B2:B), "<="&ROW(B2:B), B2:B)+1))
demo spreadsheet
if this is what you need ( to always sum total in C column ),
then you don't need arrayformula you can use this simple cell formula (this is C2 formula):
=B2+(If(ISNUMBER(C1), C1, 0))
and spread it down the page, here is the sheet I captured
cheers, kres