Share via

Need comparison in a table with different data

Anonymous
2024-09-15T12:21:04+00:00

Hi,

I have a table like this:

date consumer name service name transaction count
2024-09-12 Consumer A Service 1 10
2024-09-12 Consumer A Service 2 15
2024-09-12 Consumer B Service 1 5
2024-09-12 Consumer A Service 3 7
2024-09-12 Consumer C Service 1 8
2024-09-12 Consumer C Service 2 9
2024-09-12 Consumer B Service 2 5
2024-09-13 Consumer B Service 1 1
2024-09-13 Consumer A Service 1 4
2024-09-13 Consumer C Service 1 5
2024-09-13 Consumer A Service 2 2
2024-09-13 Consumer C Service 2 8
2024-09-13 Consumer B Service 2 7
2024-09-13 Consumer B Service 3 10

As you see, in each day there are some different consumers which each of them has its own services. the order of services of each consumer is not the same in different days and also they are not back to back in a same day!

I need to compare the count of transactions for each service of each consumer daily, if it has been increased or decreased or didn't have any changes. perfectly by arrow signs.

please let me know which formula I should use for this matter.

Thanks

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Rich~M 20,370 Reputation points Volunteer Moderator
2024-09-17T13:01:39+00:00

You need to add the headers in F1:J1. In Columns H, I, and J the formula is using the header as the criteria for the Criteria Range in Column C in the SUMIFS part of the formula. Then fill the formula over and down under all of the headers for the 3 services.

Sorry, I neglected to mention that the headers needed to be added for the formulas to work.

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-09-17T11:51:14+00:00

    Thanks for your support and help, but by adding the second formula it shows 0 for all rows.

    can you please help?

    Was this answer helpful?

    0 comments No comments
  2. Rich~M 20,370 Reputation points Volunteer Moderator
    2024-09-15T20:03:01+00:00

    Did some more work on this and here are some revised formulas. This will calculate the service count for each date/consumer combination in the chart and add the up, down and side arrows to the cells. I expanded the original data to include four dates to show the layout as it would be with a larger data sample. See the screenshot below.

    Use this formula in F2 and expand to include all of your data. Here it is with the range expanded to B500. It can be greater than the current data to allow for additional data to be added, so make it large enough to accommodate all future data.

    =LET(F,UNIQUE(FILTER($A$2:$B$500,$A$2:$A$500<>0)),SORTBY(F,CHOOSECOLS(F,2),1,CHOOSECOLS(F,1),1))

    In H2 use this with the Row 225 references expanded if needed to include all the rows of the unique list in Columns F and G. Fill across and down for all services and all rows with unique date/consumer data. It can be filled into more rows than you need to allow for additional consumers and dates to be added. The formula can be filled down as far as needed to accommodate all future data additions. It can be filled into rows that are currently empty and will result in a blank cell in those rows.

    =IF(F2="","",LET(s,SUMIFS($D$2:$D$225,$A$2:$A$225,$F2,$B$2:$B$225,$G2,$C$2:$C$225,H$1),s&" "&IFERROR(IFS(AND($G2=$G1,s>--TEXTBEFORE(H1," ")),"↑",AND($G2=$G1,s<--TEXTBEFORE(H1," ")),"↓",AND($G2=$G1,s=--TEXTBEFORE(H1," ")),"→"),"")))

    For the Conditional Formatting if desired follow steps 1-4 in the answer above with these formulas;

    Rule 1: greater number of service count formatted green.

    =IF(AND($G2=$G1,--TEXTBEFORE(H2," ")>--TEXTBEFORE(H1," ")),TRUE,FALSE)

    Rule 2: lesser number of service count formatted red (white text optional).

    =IF(AND($G2=$G1,--TEXTBEFORE(H2," ")<--TEXTBEFORE(H1," ")),TRUE,FALSE)

    Rule 3: no change in service count formatted yellow?? if desired.

    =IF(AND($G2=$G1,--TEXTBEFORE(H2," ")=--TEXTBEFORE(H1," ")),TRUE,FALSE)

    Image

    Was this answer helpful?

    0 comments No comments
  3. Rich~M 20,370 Reputation points Volunteer Moderator
    2024-09-15T14:38:05+00:00

    Here are two formulas that will create a table to compare the services received by date for the Consumers. Use this formula to create a list of the consumers and which days they received services. I entered this in F2 below.

    =SORTBY(UNIQUE($A$2:$B$15),CHOOSECOLS(UNIQUE($A$2:$B$15),2),1,CHOOSECOLS(UNIQUE($A$2:$B$15),1),)

    Use this formula to total the services by Consumer and date. I entered this in H2 and filled across and down.

    =SUMIFS($D$2:$D$15,$A$2:$A$15,$F2,$B$2:$B$15,$G2,$C$2:$C$15,H$1)

    You can use Conditional Formatting to identify if the service usage has increased or decreased from the previous date for each consumer.

    1. Highlight the entire range where you entered the second formula, H2:J7 in the screenshot.
    2. On the Home ribbon in the Styles section, open Conditional Formatting>New Rule>Use a Formula.
    3. In the Format Values line enter this formula for the rule for green if the services went up for each consumer.

    =IF(AND($G2=$G1,H2>H1),TRUE,FALSE)

    1. Click on the Format button at the lower right and in the Format Cells dialogue choose the formatting you want (green). Then click OK and OK.

    Repeat steps 1-4 with this formula for the rule for red if the services went down for each consumer.

    =IF(AND($G2=$G1,H2<H1),TRUE,FALSE)

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-09-15T14:15:12+00:00

    In E2:

    =LET(m, XMATCH(1, (A$1:A1<A2)*(B$1:B1=B2)*(C$1:C1=C2), , -1), d, D2-INDEX(D$1:D1, m), IFS(ISNA(d), "", d>0, "↑", d=0, "→", d<0, "↓"))

    Fill down.

    Was this answer helpful?

    0 comments No comments