Need help with formulas

James2376

New Member
Joined
Sep 19, 2023
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hey, im looking for a few formulas.

1)
create a cell formula in Excel that checks each 'ordrenr' in column A of 'Sheet0' against the values in column A of 'Sheet1'? If a match is found, I want the corresponding cell in 'Sheet0' to be formatted in red. For instance, if A5 in 'Sheet0' matches any cell in column A of 'Sheet1,' I'd like A5 in 'Sheet0' to turn red.


1698518053276.png


2) I got a main sheet with many products and want to sort them into 4 different sheets based on which product it is. So basically what im looking for is the products to automatically be sorted in the correct sheet.

1698519902942.png
<- Main sheet and the 4 other sheets
I have been sorting the products manually for a long time now into the different sheets, so maybe i can check the "artikkelnr." (product name) and it gets placed in the sheet that already has a column with that product. Example: So a formula for if B3 (Need it to check the whole row) has a match in row B "1(Anja prod)" or "2(856 Arctic)" or "3(Gunnebo)" or "4(858 Super) then place the column that has a match into that sheet (it should not remove the product from the main sheet, but copy the column that is a match)

Lets say B3 has a match in "2(856 Arctic)" then the first empy column should have all the info from A,B,C,D 3 (1700007 A99952042 MUTTER 2" NO 999 REX VARMGALV 900).

Hope anyone has a good idea on how to do this ;) Thanks
 
You may have this sorted out already, but for the conditional formatting, I wouldn't set the "applies to" to entire columns because conditional formatting is expensive in Excel terms and is a lot to process unnecessarily. If you can make the "applies to" a comfortable amount over the number of rows you are using to allow for expansion, it would be better for overall performance.

Below is a sample of how I tested it...if your "applies to" is more than one column and you are evaluating only one column it should change slightly to put the $ before the column to match. I mixed data types and it seems to handle it for this case, but maybe not all cases. I have text in column A of Sheet0 and numbers in column A of Sheet1.
Book1 (version 1).xlsb
ABC
1
2172080some text1140
3171577some text908
4171715some text684
5173255some text921
6170332some text898
7171593some text1549
8173139some text506
9170242some text1427
10171141some text604
11171106some text1855
12170933some text591
13172260some text1323
14172271some text1583
15172019some text1562
16170344some text1706
17173360some text1996
18172134some text1176
19173802some text1760
20171945some text724
21171879some text1387
22171924some text835
23173192some text1145
24170212some text574
25172543some text1159
26173407some text1938
27170158some text896
Sheet0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C27Expression=ISNUMBER(MATCH($A2,Sheet1!$A$2:$A$27,0))textNO

Book1 (version 1).xlsb
A
1
2172080.00
3171577.00
4172080.00
5173255.00
6170332.00
7172080.00
8173139.00
9170242.00
10170242.00
11171106.00
12170344.00
13172260.00
14170344.00
15172019.00
16170344.00
17173360.00
18170344.00
19173802.00
20170212.00
21171879.00
22170212.00
23173192.00
24170212.00
25170212.00
26170242.00
27170158.00
Sheet1

I will try to provide an example of sorting out your data into different sheets a little later today. I have to head out for a while...

Hope that helps,

Doug
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You may have this sorted out already, but for the conditional formatting, I wouldn't set the "applies to" to entire columns because conditional formatting is expensive in Excel terms and is a lot to process unnecessarily. If you can make the "applies to" a comfortable amount over the number of rows you are using to allow for expansion, it would be better for overall performance.

Below is a sample of how I tested it...if your "applies to" is more than one column and you are evaluating only one column it should change slightly to put the $ before the column to match. I mixed data types and it seems to handle it for this case, but maybe not all cases. I have text in column A of Sheet0 and numbers in column A of Sheet1.
Book1 (version 1).xlsb
ABC
1
2172080some text1140
3171577some text908
4171715some text684
5173255some text921
6170332some text898
7171593some text1549
8173139some text506
9170242some text1427
10171141some text604
11171106some text1855
12170933some text591
13172260some text1323
14172271some text1583
15172019some text1562
16170344some text1706
17173360some text1996
18172134some text1176
19173802some text1760
20171945some text724
21171879some text1387
22171924some text835
23173192some text1145
24170212some text574
25172543some text1159
26173407some text1938
27170158some text896
Sheet0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C27Expression=ISNUMBER(MATCH($A2,Sheet1!$A$2:$A$27,0))textNO

Book1 (version 1).xlsb
A
1
2172080.00
3171577.00
4172080.00
5173255.00
6170332.00
7172080.00
8173139.00
9170242.00
10170242.00
11171106.00
12170344.00
13172260.00
14170344.00
15172019.00
16170344.00
17173360.00
18170344.00
19173802.00
20170212.00
21171879.00
22170212.00
23173192.00
24170212.00
25170212.00
26170242.00
27170158.00
Sheet1

I will try to provide an example of sorting out your data into different sheets a little later today. I have to head out for a while...

Hope that helps,

Doug
Thanks for helping me Doug :)
i must be doing something wrong, because it still wont format the cells. I made a new excel sheet to test if maybe that was the problem, but not working on the test sheet either :/

1698602974882.png




1698603044170.png
 
Upvote 0
In a blank column on Sheet0 try this formula:
Excel Formula:
=MATCH(A1;Sheet1!$A$1:$A$30;0)
That should tell us if it can find a match. You can copy that down some cells to see if it matches the cells below A1.

Another option based on what I see above is to try...
Excel Formula:
A2=Sheet1!A1
to see if it returns TRUE. If not, there must be a data type mismatch causing an issue; like one is text and the other is a number.

The idea is to troubleshoot why it is not finding a match to highlight with conditional formatting.

Doug
 
Upvote 0
In a blank column on Sheet0 try this formula:
Excel Formula:
=MATCH(A1;Sheet1!$A$1:$A$30;0)
That should tell us if it can find a match. You can copy that down some cells to see if it matches the cells below A1.

Another option based on what I see above is to try...
Excel Formula:
A2=Sheet1!A1
to see if it returns TRUE. If not, there must be a data type mismatch causing an issue; like one is text and the other is a number.

The idea is to troubleshoot why it is not finding a match to highlight with conditional formatting.

Doug

=MATCH(A1;Sheet1!$A$1:$A$30;0) gives error #NAME?

=A2=Sheet1!A1 gives FALSE when used in sheet0 and TRUE when used in sheet1, so there is something wrong with the text/numbers 🤔
 
Upvote 0
On both sheets, try changing the data type to Text and see if you get better results. I am guessing that the data in that column is not being used as a number; no math is done with it?
 
Upvote 0
i have changed the data type in both sheets to text and numbers, but still getting the same results from the

=MATCH(A1;Sheet1!$A$1:$A$30;0)
and
=A2=Sheet1!A1
🤔
 
Upvote 0
Could you copy a cell from column A of Sheet0 to column A of Sheet1 to see if you get a match? If you copy and paste, they should match, right? If one of them is text, it could have an extra space, zero-length string, non-breaking space, or a non-printing character causing them not to match.

All of this adds to the idea that your data should only be in one place. Anything more to be done with the data should be done with formulas. Below is an example of getting filtered data from your main sheet to other sheets. I added the "Group" column to identify what should appear on a different sheet. If you can identify which data goes to which of the other sheets and it is not based on what is already on the other sheets, this should work well.
Book_2023-10-29.xlsm
ABCD
1NumberTextValueGroup
2172080some text1140A
3171577some text908B
4171715some text684C
5173255some text921D
6170332some text898A
7171593some text1549B
8173139some text506C
9170242some text1427D
10171141some text604A
11171106some text1855B
12170933some text591C
13172260some text1323D
14172271some text1583A
15172019some text1562B
16170344some text1706C
17173360some text1996D
18172134some text1176A
19173802some text1760B
20171945some text724C
21171879some text1387D
22171924some text835A
23173192some text1145B
24170212some text574C
25172543some text1159D
26173407some text1938A
27170158some text896B
Sheet0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D27Expression=ISNUMBER(MATCH($A2,Sheet1!$A$2:$A$27,0))textNO

Book_2023-10-29.xlsm
ABCD
1NumberTextValueGroup
2172080some text1140A
3170332some text898A
4171141some text604A
5172271some text1583A
6172134some text1176A
7171924some text835A
8173407some text1938A
Sheet4
Cell Formulas
RangeFormula
A2:D8A2=FILTER(Sheet0!A2:D27,Sheet0!D2:D27="A","none found in Group A")
Dynamic array formulas.

Doug
 
Upvote 0
On both sheets, try changing the data type to Text and see if you get better results. I am guessing that the data in that column is not being used as a number; no math is done with it?

Could you copy a cell from column A of Sheet0 to column A of Sheet1 to see if you get a match? If you copy and paste, they should match, right? If one of them is text, it could have an extra space, zero-length string, non-breaking space, or a non-printing character causing them not to match.

All of this adds to the idea that your data should only be in one place. Anything more to be done with the data should be done with formulas. Below is an example of getting filtered data from your main sheet to other sheets. I added the "Group" column to identify what should appear on a different sheet. If you can identify which data goes to which of the other sheets and it is not based on what is already on the other sheets, this should work well.
Book_2023-10-29.xlsm
ABCD
1NumberTextValueGroup
2172080some text1140A
3171577some text908B
4171715some text684C
5173255some text921D
6170332some text898A
7171593some text1549B
8173139some text506C
9170242some text1427D
10171141some text604A
11171106some text1855B
12170933some text591C
13172260some text1323D
14172271some text1583A
15172019some text1562B
16170344some text1706C
17173360some text1996D
18172134some text1176A
19173802some text1760B
20171945some text724C
21171879some text1387D
22171924some text835A
23173192some text1145B
24170212some text574C
25172543some text1159D
26173407some text1938A
27170158some text896B
Sheet0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D27Expression=ISNUMBER(MATCH($A2,Sheet1!$A$2:$A$27,0))textNO

Book_2023-10-29.xlsm
ABCD
1NumberTextValueGroup
2172080some text1140A
3170332some text898A
4171141some text604A
5172271some text1583A
6172134some text1176A
7171924some text835A
8173407some text1938A
Sheet4
Cell Formulas
RangeFormula
A2:D8A2=FILTER(Sheet0!A2:D27,Sheet0!D2:D27="A","none found in Group A")
Dynamic array formulas.

Doug
1698700931130.png


The
=MATCH(A1;Sheet1!$A$1:$A$30;0)
and
=A2=Sheet1!A1 works when i copy paste the lines from sheet0 into sheet1 (copy pasted A3 and A4 from sheet0 to sheet1), so the problem is most likely a difference in the cell formatting, text, numbers etc. What should i do to fix this? I will also try to make a column with groups like you showed in your example above and see if i can get that to work ;)
 
Upvote 0
It took us a while to arrive at that. Was the data on Sheet1 copied and pasted from Sheet0? It is unclear how they are different if they came from the same data.

If you devise a way to group and filter, all of the conditional formatting may not be needed. If you want to continue down the road of figuring out how your data between Sheet0 and Sheet1 is different, I will need to see a small sample of your actual data. If you can post it with XL2BB, that would be preferred. A second option would be to provide a link to a file.
 
Upvote 0
It took us a while to arrive at that. Was the data on Sheet1 copied and pasted from Sheet0? It is unclear how they are different if they came from the same data.

If you devise a way to group and filter, all of the conditional formatting may not be needed. If you want to continue down the road of figuring out how your data between Sheet0 and Sheet1 is different, I will need to see a small sample of your actual data. If you can post it with XL2BB, that would be preferred. A second option would be to provide a link to a file.

Excel Link

^^ Used the excel share function. ORDRE MAT 002 is sheet0 and anja prod is sheet1
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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