Google Sheet - Math formula inside a Google Sheet formula

Naegino

New Member
Joined
Mar 22, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I work as an HR Manager for a company. I have an Absence sheet where I record the daily absences of colleagues. My company's executives recently decided they would use the Barford Score System (which gives each colleague a score based on their total number of absences (due to sickness) and the occurrence of sickness. The Bradford score is the Total number of sick days * sick days occurencies^2. This Braford formula I would like to implement in a Query function. My formula so far looks like this: =UNIQUE(QUERY('Bradford Score_raw_DATA_2023/24'!B4:H, "SELECT E, SUM(G), SUM(H), SUM(G)*SUM(H)^2
WHERE E IS NOT NULL
GROUP BY E
LABEL E 'NAME', SUM(G) 'SICK DAYS (S)', SUM(H) 'SICK OCCURRENCES (D)', SUM(G)*SUM(H)^2 'BARDFORD SCORE'"))

Where in Bradford Score_raw_DATA:
- E is the colleague's name
- SUM(G) is the summed total days of sickness
- SUM(H) is the summed total sickness occurrences
In this sheet called Barford 2023/24 from D4 to G I would like to import the values and names. It is working perfectly If I don't add this part in the formula SUM(G), SUM(H), SUM(G)*SUM(H)^2 & SUM(G)*SUM(H)^2 'BARDFORD SCORE'"))

The problem is due to some reasons in the sheet named Bradford 2023/24 I have to add the mentioned part which will appear in column G, because with the query formula, I would like to keep the "
GROUP BY E" part, but also If I manually do the barford score in column G I can not (even tho with filter) order them by the Bardford scores. That is the reason I would like to calculate the score within the Query Formula, but it constantly gives this error:
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " <ID> "AS "" at line 1, column 45. Was expecting one of: <EOF> "where" ... "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ... "," ... "*" ... "+" ... "-" ... "/" ... "%" ...

Can anyone please help me with how to make this work?

Thank you so much for your suggestions and time!

Best,
Josh
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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